From 6d294e6bcb7a8bbefbce62ad8e553f4cae5bde3d Mon Sep 17 00:00:00 2001 From: Alex McArther Date: Tue, 23 Jan 2018 07:55:50 -0800 Subject: [PATCH] Make rustfmt-bin's CARGO_PKG_VERSION envvar optional --- src/bin/rustfmt.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/rustfmt.rs b/src/bin/rustfmt.rs index ba586e1fd91..5a9119cdb11 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")) ) }