about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNick Cameron <nrc@ncameron.org>2016-07-04 21:30:52 +1200
committerGitHub <noreply@github.com>2016-07-04 21:30:52 +1200
commitffa5a22d1c91d0648ab63de101afcc610caefccd (patch)
tree030e8c4ceaf57b88b257f2df4634fde279a98ee3 /src
parentb51bcbfbeff508029bf824bdca586eec20fb7c0a (diff)
parent033741246cdb8c653cc3bf9a6cc12f23dac08e6e (diff)
Merge pull request #1084 from johannhof/rustfmt-not-found
Show more helpful error if rustfmt is not in PATH.
Diffstat (limited to 'src')
-rw-r--r--src/bin/cargo-fmt.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/bin/cargo-fmt.rs b/src/bin/cargo-fmt.rs
index 93a9326918c..3c3ce223318 100644
--- a/src/bin/cargo-fmt.rs
+++ b/src/bin/cargo-fmt.rs
@@ -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()
 }