File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -450,13 +450,14 @@ are included as out of line modules from `src/lib.rs`."
450450}
451451
452452fn print_version ( ) {
453- let version_info = format ! (
454- "{}-{}" ,
455- option_env!( "CARGO_PKG_VERSION" ) . unwrap_or( "unknown" ) ,
456- include_str!( concat!( env!( "OUT_DIR" ) , "/commit-info.txt" ) )
457- ) ;
453+ let version_number = option_env ! ( "CARGO_PKG_VERSION" ) . unwrap_or ( "unknown" ) ;
454+ let commit_info = include_str ! ( concat!( env!( "OUT_DIR" ) , "/commit-info.txt" ) ) ;
458455
459- println ! ( "rustfmt {version_info}" ) ;
456+ if commit_info. is_empty ( ) {
457+ println ! ( "rustfmt {version_number}" ) ;
458+ } else {
459+ println ! ( "rustfmt {version_number}-{commit_info}" ) ;
460+ }
460461}
461462
462463fn determine_operation ( matches : & Matches ) -> Result < Operation , OperationError > {
You can’t perform that action at this time.
0 commit comments