Skip to content

Commit c1fa467

Browse files
committed
option_env
1 parent ef05a2d commit c1fa467

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

rustfmt-bin/src/main.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -386,14 +386,14 @@ fn print_usage_to_stdout(opts: &Options, reason: &str) {
386386
}
387387

388388
fn print_version() {
389-
println!(
390-
"rustfmt {}",
391-
concat!(
392-
env!("CARGO_PKG_VERSION"),
393-
"-",
394-
include_str!(concat!(env!("OUT_DIR"), "/commit-info.txt"))
395-
)
389+
let version_info = format!(
390+
"{}{}{}",
391+
option_env!("CARGO_PKG_VERSION").unwrap_or("unknown"),
392+
"-",
393+
include_str!(concat!(env!("OUT_DIR"), "/commit-info.txt"))
396394
);
395+
396+
println!("rustfmt {}", version_info);
397397
}
398398

399399
fn determine_operation(matches: &Matches) -> FmtResult<Operation> {

0 commit comments

Comments
 (0)