File tree 1 file changed +5
-7
lines changed
1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ use serialize::json;
44
44
45
45
use std:: any:: Any ;
46
46
use std:: env;
47
- use std:: ffi:: { OsStr , OsString } ;
47
+ use std:: ffi:: OsString ;
48
48
use std:: fs;
49
49
use std:: io:: { self , Write } ;
50
50
use std:: iter;
@@ -1648,14 +1648,14 @@ pub fn build_output_filenames(
1648
1648
// "-" as input file will cause the parser to read from stdin so we
1649
1649
// have to make up a name
1650
1650
// 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 ( ) ;
1652
1652
1653
1653
// If a crate name is present, we use it as the link name
1654
1654
let stem = sess. opts
1655
1655
. crate_name
1656
1656
. clone ( )
1657
1657
. or_else ( || attr:: find_crate_name ( attrs) . map ( |n| n. to_string ( ) ) )
1658
- . unwrap_or ( input. filestem ( ) ) ;
1658
+ . unwrap_or_else ( || input. filestem ( ) ) ;
1659
1659
1660
1660
OutputFilenames {
1661
1661
out_directory : dirpath,
@@ -1688,13 +1688,11 @@ pub fn build_output_filenames(
1688
1688
sess. warn ( "ignoring -C extra-filename flag due to -o flag" ) ;
1689
1689
}
1690
1690
1691
- let cur_dir = Path :: new ( "" ) ;
1692
-
1693
1691
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 ( ) ,
1695
1693
out_filestem : out_file
1696
1694
. file_stem ( )
1697
- . unwrap_or ( OsStr :: new ( "" ) )
1695
+ . unwrap_or_default ( )
1698
1696
. to_str ( )
1699
1697
. unwrap ( )
1700
1698
. to_string ( ) ,
You can’t perform that action at this time.
0 commit comments