diff --git a/src/cargo-fmt/main.rs b/src/cargo-fmt/main.rs index 59b76a542792..55f098348b99 100644 --- a/src/cargo-fmt/main.rs +++ b/src/cargo-fmt/main.rs @@ -127,7 +127,14 @@ fn get_version() -> Result { let mut command = Command::new("rustfmt") .stdout(std::process::Stdio::inherit()) .args(&[String::from("--version")]) - .spawn()?; + .spawn() + .map_err(|e| match e.kind() { + io::ErrorKind::NotFound => io::Error::new( + io::ErrorKind::Other, + "Could not run rustfmt, please make sure it is in your PATH.", + ), + _ => e, + })?; status.push(command.wait()?); Ok(status