]> git.lizzy.rs Git - rust.git/blobdiff - src/bin/cargo-fmt.rs
Merge pull request #1084 from johannhof/rustfmt-not-found
[rust.git] / src / bin / cargo-fmt.rs
index 93a9326918ca6d1411f91bf2985fe46b84043a59..3c3ce2233183e8a3087c012b5d465a21f5367788 100644 (file)
@@ -203,6 +203,16 @@ fn format_files(files: &Vec<PathBuf>,
         .stdout(stdout)
         .args(files)
         .args(fmt_args)
-        .spawn());
+        .spawn()
+        .map_err(|e| {
+            match e.kind() {
+                std::io::ErrorKind::NotFound => {
+                    std::io::Error::new(std::io::ErrorKind::Other,
+                                        "Could not run rustfmt, please make sure it is in your \
+                                         PATH.")
+                }
+                _ => e,
+            }
+        }));
     command.wait()
 }