File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ use serialize::json;
4444
4545use std:: any:: Any ;
4646use std:: env;
47- use std:: ffi:: { OsStr , OsString } ;
47+ use std:: ffi:: OsString ;
4848use std:: fs;
4949use std:: io:: { self , Write } ;
5050use std:: iter;
@@ -1648,14 +1648,14 @@ pub fn build_output_filenames(
16481648 // "-" as input file will cause the parser to read from stdin so we
16491649 // have to make up a name
16501650 // We want to toss everything after the final '.'
1651- let dirpath = ( * odir) . as_ref ( ) . cloned ( ) . unwrap_or_else ( || PathBuf :: new ( ) ) ;
1651+ let dirpath = ( * odir) . as_ref ( ) . cloned ( ) . unwrap_or_default ( ) ;
16521652
16531653 // If a crate name is present, we use it as the link name
16541654 let stem = sess. opts
16551655 . crate_name
16561656 . clone ( )
16571657 . or_else ( || attr:: find_crate_name ( attrs) . map ( |n| n. to_string ( ) ) )
1658- . unwrap_or ( input. filestem ( ) ) ;
1658+ . unwrap_or_else ( || input. filestem ( ) ) ;
16591659
16601660 OutputFilenames {
16611661 out_directory : dirpath,
@@ -1688,13 +1688,11 @@ pub fn build_output_filenames(
16881688 sess. warn ( "ignoring -C extra-filename flag due to -o flag" ) ;
16891689 }
16901690
1691- let cur_dir = Path :: new ( "" ) ;
1692-
16931691 OutputFilenames {
1694- out_directory : out_file. parent ( ) . unwrap_or ( cur_dir ) . to_path_buf ( ) ,
1692+ out_directory : out_file. parent ( ) . unwrap_or_else ( || Path :: new ( "" ) ) . to_path_buf ( ) ,
16951693 out_filestem : out_file
16961694 . file_stem ( )
1697- . unwrap_or ( OsStr :: new ( "" ) )
1695+ . unwrap_or_default ( )
16981696 . to_str ( )
16991697 . unwrap ( )
17001698 . to_string ( ) ,
You can’t perform that action at this time.
0 commit comments