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/librustdoc/html | |
| 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/librustdoc/html')
| -rw-r--r-- | src/librustdoc/html/format.rs | 8 | ||||
| -rw-r--r-- | src/librustdoc/html/markdown.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/html/render.rs | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index cec665768d1..382e299d28d 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -351,7 +351,7 @@ impl fmt::Show for clean::Type { tybounds(f, typarams) } clean::Self(..) => f.write("Self".as_bytes()), - clean::Primitive(prim) => primitive_link(f, prim, prim.to_str()), + clean::Primitive(prim) => primitive_link(f, prim, prim.to_string()), clean::Closure(ref decl, ref region) => { write!(f, "{style}{lifetimes}|{args}|{bounds}{arrow}", style = FnStyleSpace(decl.fn_style), @@ -405,7 +405,7 @@ impl fmt::Show for clean::Type { } else { let mut m = decl.bounds .iter() - .map(|s| s.to_str()); + .map(|s| s.to_string()); format!( ": {}", m.collect::<Vec<String>>().connect(" + ")) @@ -607,7 +607,7 @@ impl<'a> fmt::Show for Stability<'a> { match *stab { Some(ref stability) => { write!(f, "<a class='stability {lvl}' title='{reason}'>{lvl}</a>", - lvl = stability.level.to_str(), + lvl = stability.level.to_string(), reason = stability.text) } None => Ok(()) @@ -621,7 +621,7 @@ impl<'a> fmt::Show for ConciseStability<'a> { match *stab { Some(ref stability) => { write!(f, "<a class='stability {lvl}' title='{lvl}{colon}{reason}'></a>", - lvl = stability.level.to_str(), + lvl = stability.level.to_string(), colon = if stability.text.len() > 0 { ": " } else { "" }, reason = stability.text) } diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index de4bbeb6e30..19a9bcb9a17 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -229,7 +229,7 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result { // Transform the contents of the header into a hyphenated string let id = s.as_slice().words().map(|s| { match s.to_ascii_opt() { - Some(s) => s.to_lower().into_str(), + Some(s) => s.to_lower().into_string(), None => s.to_string() } }).collect::<Vec<String>>().connect("-"); diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 917eab4eeb9..eeeee8cedf1 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -428,7 +428,7 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> io::IoResult<String> } try!(write!(&mut w, r#"[{:u},"{}","{}",{}"#, item.ty, item.name, path, - item.desc.to_json().to_str())); + item.desc.to_json().to_string())); match item.parent { Some(nodeid) => { let pathid = *nodeid_to_pathid.find(&nodeid).unwrap(); |
