std: Rename the ToStr trait to ToString, and to_str to to_string#15493
Merged
bors merged 1 commit intorust-lang:masterfrom Jul 8, 2014
Merged
std: Rename the ToStr trait to ToString, and to_str to to_string#15493bors merged 1 commit intorust-lang:masterfrom
ToStr trait to ToString, and to_str to to_string#15493bors merged 1 commit intorust-lang:masterfrom
Conversation
Contributor
Author
|
I haven't actually seen this pass |
Closed
Contributor
|
Amazing, thanks for picking up my slack :) |
…ng`. [breaking-change]
bors
added a commit
that referenced
this pull request
Jul 8, 2014
This updates #15075. Rename `ToStr::to_str` to `ToString::to_string`. The naive renaming ends up with two `to_string` functions defined on strings in the prelude (the other defined via `collections::str::StrAllocating`). To remedy this I removed `StrAllocating::to_string`, making all conversions from `&str` to `String` go through `Show`. 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 unify `to_string` and address performance for all `to_string` conversions in `core::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.
Contributor
|
\o/ Thanks so much for landing this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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_strtoToString::to_string. The naive renaming ends up with twoto_stringfunctions defined on strings in the prelude (the other defined viacollections::str::StrAllocating). To remedy this I removedStrAllocating::to_string, making all conversions from&strtoStringgo 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_stringand address performance for allto_stringconversions 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_strfunctions, particularly inside of rustc. All the ones I saw looked correct, and I didn't notice any additional API breakage.Closes #15046.