diff --git a/src/bin/rustfmt.rs b/src/bin/rustfmt.rs index ba586e1fd913..5a9119cdb111 100644 --- a/src/bin/rustfmt.rs +++ b/src/bin/rustfmt.rs @@ -387,7 +387,7 @@ fn print_usage_to_stdout(opts: &Options, reason: &str) { fn print_version() { println!( "{}-nightly{}", - env!("CARGO_PKG_VERSION"), + option_env!("CARGO_PKG_VERSION").unwrap_or("unknown"), include_str!(concat!(env!("OUT_DIR"), "/commit-info.txt")) ) }