diff options
| author | bors <bors@rust-lang.org> | 2014-07-08 20:06:40 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-07-08 20:06:40 +0000 |
| commit | 8bb34a3146e6ba4bc7902a85de90cf4f8064ace0 (patch) | |
| tree | f5dd9ae1066eb755649fcced85e998d72147de19 /src/libstd/path | |
| parent | 35e21346216cc4c5a3b22bb6fb316f8c867f8c92 (diff) | |
| parent | 12c334a77b897f7b1cb6cff3c56a71ecb89c82af (diff) | |
| download | rust-8bb34a3146e6ba4bc7902a85de90cf4f8064ace0.tar.gz rust-8bb34a3146e6ba4bc7902a85de90cf4f8064ace0.zip | |
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.
Diffstat (limited to 'src/libstd/path')
| -rw-r--r-- | src/libstd/path/posix.rs | 2 | ||||
| -rw-r--r-- | src/libstd/path/windows.rs | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs index d98cfb7d8ee..5c6e140bd29 100644 --- a/src/libstd/path/posix.rs +++ b/src/libstd/path/posix.rs @@ -545,7 +545,7 @@ mod tests { ($path:expr, $disp:ident, $exp:expr) => ( { let path = Path::new($path); - assert!(path.$disp().to_str().as_slice() == $exp); + assert!(path.$disp().to_string().as_slice() == $exp); } ) ) diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs index 113b0410875..206f75739e8 100644 --- a/src/libstd/path/windows.rs +++ b/src/libstd/path/windows.rs @@ -1314,9 +1314,9 @@ mod tests { #[test] fn test_display_str() { let path = Path::new("foo"); - assert_eq!(path.display().to_str(), "foo".to_string()); + assert_eq!(path.display().to_string(), "foo".to_string()); let path = Path::new(b"\\"); - assert_eq!(path.filename_display().to_str(), "".to_string()); + assert_eq!(path.filename_display().to_string(), "".to_string()); let path = Path::new("foo"); let mo = path.display().as_maybe_owned(); |
