]> git.lizzy.rs Git - rust.git/blobdiff - src/cargo-fmt/main.rs
Use concat() instead of join("")
[rust.git] / src / cargo-fmt / main.rs
index 2d8234ef41e39a50e9dae1d79cbed67a40e6bd62..eee102b6bf8b8ab03e0df774000cfd24b2798065 100644 (file)
@@ -149,7 +149,7 @@ fn format_crate(
     let rustfmt_args = get_fmt_args();
     let targets = if rustfmt_args
         .iter()
-        .any(|s| ["--print-config", "-h", "--help", "-V", "--verison"].contains(&s.as_str()))
+        .any(|s| ["--print-config", "-h", "--help", "-V", "--version"].contains(&s.as_str()))
     {
         HashSet::new()
     } else {
@@ -163,7 +163,8 @@ fn format_crate(
             if verbosity == Verbosity::Verbose {
                 println!("[{}] {:?}", t.kind, t.path)
             }
-        }).map(|t| t.path)
+        })
+        .map(|t| t.path)
         .collect();
 
     run_rustfmt(&files, &rustfmt_args, verbosity)
@@ -373,9 +374,6 @@ fn run_rustfmt(
 fn get_cargo_metadata(manifest_path: Option<&Path>) -> Result<cargo_metadata::Metadata, io::Error> {
     match cargo_metadata::metadata(manifest_path) {
         Ok(metadata) => Ok(metadata),
-        Err(..) => Err(io::Error::new(
-            io::ErrorKind::Other,
-            "`cargo manifest` failed.",
-        )),
+        Err(error) => Err(io::Error::new(io::ErrorKind::Other, error.to_string())),
     }
 }