auto merge of #15493 : brson/rust/tostr, r=pcwalton

This updates https://github.com/rust-lang/rust/pull/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.
This commit is contained in:
bors
2014-07-08 20:06:40 +00:00
208 changed files with 1557 additions and 1390 deletions

View File

@@ -681,7 +681,7 @@ pub enum IntTy {
impl fmt::Show for IntTy {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", ast_util::int_ty_to_str(*self, None))
write!(f, "{}", ast_util::int_ty_to_string(*self, None))
}
}
@@ -696,7 +696,7 @@ pub enum UintTy {
impl fmt::Show for UintTy {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", ast_util::uint_ty_to_str(*self, None))
write!(f, "{}", ast_util::uint_ty_to_string(*self, None))
}
}
@@ -708,7 +708,7 @@ pub enum FloatTy {
impl fmt::Show for FloatTy {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", ast_util::float_ty_to_str(*self))
write!(f, "{}", ast_util::float_ty_to_string(*self))
}
}