diff --git a/src/bin/cargo-fmt.rs b/src/bin/cargo-fmt.rs index 93a9326918ca..3c3ce2233183 100644 --- a/src/bin/cargo-fmt.rs +++ b/src/bin/cargo-fmt.rs @@ -203,6 +203,16 @@ fn format_files(files: &Vec, .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() }