std: Rename the ToStr
trait to ToString
, and to_str
to to_string
#15493
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This updates #15075.
Rename
ToStr::to_str
toToString::to_string
. The naive renaming ends up with twoto_string
functions defined on strings in the prelude (the other defined viacollections::str::StrAllocating
). To remedy this I removedStrAllocating::to_string
, making all conversions from&str
toString
go throughShow
. This has a measurable impact on the speed of this conversion, but the sense I get from others is that it's best to go ahead and unifyto_string
and address performance for allto_string
conversions incore::fmt
.String::from_str(...)
still works as a manual fast-path.Note that the patch was done with a script, and ended up renaming a number of other
*_to_str
functions, particularly inside of rustc. All the ones I saw looked correct, and I didn't notice any additional API breakage.Closes #15046.