Skip to content
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

Document that Display entails ToString #92941

Closed
steffahn opened this issue Jan 15, 2022 · 3 comments · Fixed by #102322
Closed

Document that Display entails ToString #92941

steffahn opened this issue Jan 15, 2022 · 3 comments · Fixed by #102322
Assignees
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools C-enhancement Category: An issue proposing an enhancement or a PR with one. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-help-wanted Call for participation: Help is requested to fix this issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Comments

@steffahn
Copy link
Member

steffahn commented Jan 15, 2022

I just answered a question on URLO about when to implement or not to implement Display, and I noticed that the docs on the Display trait are lacking.

In particular, I believe they should definitely point out that implementing Display will give a type a .to_string() method via the ToString trait. This is important to keep in mind when you’re designing an API; it’s also the reason why in the standard library Path doesn’t implement Display directly (but offers a .display() method): because converting Path to String is lossy or fallible, and an (implicitly) lossy to_string method would not fit the API.

@rustbot label A-docs, C-enhancement, T-libs-api

@rustbot rustbot added A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools C-enhancement Category: An issue proposing an enhancement or a PR with one. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Jan 15, 2022
@dtolnay dtolnay added T-libs Relevant to the library team, which will review and decide on the PR/issue. and removed T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Jan 15, 2022
@yaahc yaahc added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-help-wanted Call for participation: Help is requested to fix this issue. labels Mar 1, 2022
@JKAnderson409
Copy link

@rustbot claim

@sigaloid
Copy link
Contributor

sigaloid commented Sep 26, 2022

@rustbot claim

Edit: Not sure if I stole this from you @JKAnderson409 , on my end it looks like you were unassigned most recently.

@rustbot rustbot assigned sigaloid and unassigned JKAnderson409 Sep 26, 2022
notriddle added a commit to notriddle/rust that referenced this issue Sep 26, 2022
Document that Display automatically implements ToString

Closes rust-lang#92941

r? rust-lang/docs
@bors bors closed this as completed in 66bab6b Sep 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools C-enhancement Category: An issue proposing an enhancement or a PR with one. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-help-wanted Call for participation: Help is requested to fix this issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants
@dtolnay @yaahc @steffahn @JKAnderson409 @rustbot @sigaloid and others