about summary refs log tree commit diff
path: root/src/librustdoc
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
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')
-rw-r--r--src/librustdoc/html/markdown.rs6
-rw-r--r--src/librustdoc/html/render.rs3
-rw-r--r--src/librustdoc/lib.rs23
-rw-r--r--src/librustdoc/markdown.rs9
-rw-r--r--src/librustdoc/passes.rs2
5 files changed, 10 insertions, 33 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),
                     });
diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs
index 00c5c2a218d..be14ffa87af 100644
--- a/src/librustdoc/lib.rs
+++ b/src/librustdoc/lib.rs
@@ -85,10 +85,7 @@ local_data_key!(pub analysiskey: core::CrateAnalysis)
 type Output = (clean::Crate, Vec<plugins::PluginJson> );
 
 pub fn main() {
-    std::os::set_exit_status(main_args(std::os::args().iter()
-                                                      .map(|x| x.to_string())
-                                                      .collect::<Vec<_>>()
-                                                      .as_slice()));
+    std::os::set_exit_status(main_args(std::os::args().as_slice()));
 }
 
 pub fn opts() -> Vec<getopts::OptGroup> {
@@ -184,17 +181,10 @@ pub fn main_args(args: &[String]) -> int {
 
     match (should_test, markdown_input) {
         (true, true) => {
-            return markdown::test(input,
-                                  libs,
-                                  test_args.move_iter().collect())
+            return markdown::test(input, libs, test_args)
         }
         (true, false) => {
-            return test::run(input,
-                             cfgs.move_iter()
-                                 .map(|x| x.to_string())
-                                 .collect(),
-                             libs,
-                             test_args)
+            return test::run(input, cfgs, libs, test_args)
         }
         (false, true) => return markdown::render(input, output.unwrap_or(Path::new("doc")),
                                                  &matches),
@@ -273,10 +263,7 @@ fn acquire_input(input: &str,
 fn rust_input(cratefile: &str, matches: &getopts::Matches) -> Output {
     let mut default_passes = !matches.opt_present("no-defaults");
     let mut passes = matches.opt_strs("passes");
-    let mut plugins = matches.opt_strs("plugins")
-                             .move_iter()
-                             .map(|x| x.to_string())
-                             .collect::<Vec<_>>();
+    let mut plugins = matches.opt_strs("plugins");
 
     // First, parse the crate and extract all relevant information.
     let libs: Vec<Path> = matches.opt_strs("L")
@@ -289,7 +276,7 @@ fn rust_input(cratefile: &str, matches: &getopts::Matches) -> Output {
     let (krate, analysis) = std::task::try(proc() {
         let cr = cr;
         core::run_core(libs.move_iter().map(|x| x.clone()).collect(),
-                       cfgs.move_iter().map(|x| x.to_string()).collect(),
+                       cfgs,
                        &cr)
     }).map_err(|boxed_any|format!("{:?}", boxed_any)).unwrap();
     info!("finished with rustc");
diff --git a/src/librustdoc/markdown.rs b/src/librustdoc/markdown.rs
index 3b6203ef668..76366240f1a 100644
--- a/src/librustdoc/markdown.rs
+++ b/src/librustdoc/markdown.rs
@@ -93,19 +93,10 @@ pub fn render(input: &str, mut output: Path, matches: &getopts::Matches) -> int
 
     let (in_header, before_content, after_content) =
         match (load_external_files(matches.opt_strs("markdown-in-header")
-                                          .move_iter()
-                                          .map(|x| x.to_string())
-                                          .collect::<Vec<_>>()
                                           .as_slice()),
                load_external_files(matches.opt_strs("markdown-before-content")
-                                          .move_iter()
-                                          .map(|x| x.to_string())
-                                          .collect::<Vec<_>>()
                                           .as_slice()),
                load_external_files(matches.opt_strs("markdown-after-content")
-                                          .move_iter()
-                                          .map(|x| x.to_string())
-                                          .collect::<Vec<_>>()
                                           .as_slice())) {
         (Some(a), Some(b), Some(c)) => (a,b,c),
         _ => return 3
diff --git a/src/librustdoc/passes.rs b/src/librustdoc/passes.rs
index 31eb83cb920..5145a4f254e 100644
--- a/src/librustdoc/passes.rs
+++ b/src/librustdoc/passes.rs
@@ -348,7 +348,7 @@ pub fn unindent(s: &str) -> String {
                 line.slice_from(min_indent).to_string()
             }
         }).collect::<Vec<_>>().as_slice());
-        unindented.connect("\n").to_string()
+        unindented.connect("\n")
     } else {
         s.to_string()
     }