about summary refs log tree commit diff
path: root/src/librustdoc/html
diff options
context:
space:
mode:
authorPiotr Jawniak <sawyer47@gmail.com>2014-06-26 08:15:14 +0200
committerPiotr Jawniak <sawyer47@gmail.com>2014-06-26 08:56:49 +0200
commitf8e06c49650afd7c9ef749baa72cb8da59880f96 (patch)
tree5d9325ebd7357f26b59ee719b7b8be2d39e43c1d /src/librustdoc/html
parent99519cc8e645dd50522c2f32cf55ef8c15583012 (diff)
downloadrust-f8e06c49650afd7c9ef749baa72cb8da59880f96.tar.gz
rust-f8e06c49650afd7c9ef749baa72cb8da59880f96.zip
Remove unnecessary to_string calls
This commit removes superfluous to_string calls from various places
Diffstat (limited to 'src/librustdoc/html')
-rw-r--r--src/librustdoc/html/markdown.rs6
-rw-r--r--src/librustdoc/html/render.rs3
2 files changed, 4 insertions, 5 deletions
diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs
index ccd11c67611..cfd004c0c83 100644
--- a/src/librustdoc/html/markdown.rs
+++ b/src/librustdoc/html/markdown.rs
@@ -228,12 +228,12 @@ 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| {
+        let id = s.as_slice().words().map(|s| {
             match s.to_ascii_opt() {
                 Some(s) => s.to_lower().into_str(),
                 None => s.to_string()
             }
-        }).collect::<Vec<String>>().connect("-")).to_string();
+        }).collect::<Vec<String>>().connect("-");
 
         // This is a terrible hack working around how hoedown gives us rendered
         // html for text rather than the raw text.
@@ -252,7 +252,7 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result {
 
         let sec = match opaque.toc_builder {
             Some(ref mut builder) => {
-                builder.push(level as u32, s.to_string(), id.clone())
+                builder.push(level as u32, s.clone(), id.clone())
             }
             None => {""}
         };
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index 76e604ecfa2..aacb13156b7 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -370,8 +370,7 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> io::IoResult<String>
                     search_index.push(IndexItem {
                         ty: shortty(item),
                         name: item.name.clone().unwrap(),
-                        path: fqp.slice_to(fqp.len() - 1).connect("::")
-                                                         .to_string(),
+                        path: fqp.slice_to(fqp.len() - 1).connect("::"),
                         desc: shorter(item.doc_value()).to_string(),
                         parent: Some(did),
                     });