Skip to content

Mention ToString in std::fmt docs #57195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 30, 2018

Conversation

czipperz
Copy link
Contributor

I believe this should be added because x.to_string() is preferred over format!("{}", x) as the recommended way to convert a value to a string. std::fmt and the format macro is where people look for documentation about this, and thus we should include references to this preferred functions there.

Resolves #55065

@rust-highfive
Copy link
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @kennytm (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 29, 2018
@Centril
Copy link
Contributor

Centril commented Dec 29, 2018

Seems right to me; but since this affects conventions I'm randomly reassigning to someone from T-Libs:

r? @SimonSapin

@rust-highfive rust-highfive assigned SimonSapin and unassigned kennytm Dec 29, 2018
@kennytm kennytm added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Dec 29, 2018
@SimonSapin
Copy link
Contributor

Seems uncontroversial to me, but to nit-pick I’d tweak the wording as: “To convert a single value to a string with the default formatting, use the to_string method.”

@Centril Centril added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 29, 2018
@czipperz
Copy link
Contributor Author

I reworded it to "To convert a single value to a string, use the [to_string] method. This will use the [Display] formatting trait.". I will squash these commits together if this looks good to you @SimonSapin . Thanks for helping.

@Centril Centril added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 29, 2018
@SimonSapin
Copy link
Contributor

Looks good, thanks!

@bors r+

@bors
Copy link
Collaborator

bors commented Dec 30, 2018

📌 Commit 0637bd5023cc6353debd2b7271e746c4c93d4ed0 has been approved by SimonSapin

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 30, 2018
@czipperz
Copy link
Contributor Author

@SimonSapin should I squash these?

@SimonSapin
Copy link
Contributor

If you want to, feel free and I’ll r+ again. The test suites should pass either way, which is already a nice-to-have and not a true requirement as far as I know.

@czipperz czipperz force-pushed the mention_ToString_in_std_fmt_docs branch from 0637bd5 to 56d6ff0 Compare December 30, 2018 00:32
@SimonSapin
Copy link
Contributor

@bors r+

@bors
Copy link
Collaborator

bors commented Dec 30, 2018

📌 Commit 56d6ff0 has been approved by SimonSapin

@bors
Copy link
Collaborator

bors commented Dec 30, 2018

⌛ Testing commit 56d6ff0 with merge 0e6f898...

bors added a commit that referenced this pull request Dec 30, 2018
…imonSapin

Mention ToString in std::fmt docs

I believe this should be added because `x.to_string()` is preferred over `format!("{}", x)` as the recommended way to convert a value to a string.  `std::fmt` and the `format` macro is where people look for documentation about this, and thus we should include references to this preferred functions there.

Resolves #55065
@bors
Copy link
Collaborator

bors commented Dec 30, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: SimonSapin
Pushing 0e6f898 to master...

@bors bors merged commit 56d6ff0 into rust-lang:master Dec 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants