@@ -18,7 +18,6 @@ use std::str;
18
18
use build_helper:: { output, t, up_to_date} ;
19
19
use filetime:: FileTime ;
20
20
use serde:: Deserialize ;
21
- use serde_json;
22
21
23
22
use crate :: builder:: Cargo ;
24
23
use crate :: dist;
@@ -149,7 +148,8 @@ fn copy_third_party_objects(
149
148
// which is provided by std for this target.
150
149
if target == "x86_64-fortanix-unknown-sgx" {
151
150
let src_path_env = "X86_FORTANIX_SGX_LIBS" ;
152
- let src = env:: var ( src_path_env) . expect ( & format ! ( "{} not found in env" , src_path_env) ) ;
151
+ let src =
152
+ env:: var ( src_path_env) . unwrap_or_else ( |_| panic ! ( "{} not found in env" , src_path_env) ) ;
153
153
copy_and_stamp ( Path :: new ( & src) , "libunwind.a" ) ;
154
154
}
155
155
@@ -361,7 +361,7 @@ impl Step for StartupObjects {
361
361
) ;
362
362
}
363
363
364
- let target = sysroot_dir. join ( file. to_string ( ) + ".o" ) ;
364
+ let target = sysroot_dir. join ( ( * file) . to_string ( ) + ".o" ) ;
365
365
builder. copy ( dst_file, & target) ;
366
366
target_deps. push ( target) ;
367
367
}
@@ -515,7 +515,7 @@ pub fn rustc_cargo_env(builder: &Builder<'_>, cargo: &mut Cargo, target: Interne
515
515
. env ( "CFG_VERSION" , builder. rust_version ( ) )
516
516
. env ( "CFG_PREFIX" , builder. config . prefix . clone ( ) . unwrap_or_default ( ) ) ;
517
517
518
- let libdir_relative = builder. config . libdir_relative ( ) . unwrap_or ( Path :: new ( "lib" ) ) ;
518
+ let libdir_relative = builder. config . libdir_relative ( ) . unwrap_or_else ( || Path :: new ( "lib" ) ) ;
519
519
cargo. env ( "CFG_LIBDIR_RELATIVE" , libdir_relative) ;
520
520
521
521
if let Some ( ref ver_date) = builder. rust_info . commit_date ( ) {
@@ -843,11 +843,11 @@ pub fn run_cargo(
843
843
} ;
844
844
for filename in filenames {
845
845
// Skip files like executables
846
- if !filename. ends_with ( ".rlib" )
847
- && ! filename. ends_with ( ".lib" )
848
- && ! filename. ends_with ( ".a" )
849
- && ! is_dylib ( & filename)
850
- && ! ( is_check && filename. ends_with ( ".rmeta" ) )
846
+ if !( filename. ends_with ( ".rlib" )
847
+ || filename. ends_with ( ".lib" )
848
+ || filename. ends_with ( ".a" )
849
+ || is_dylib ( & filename)
850
+ || ( is_check && filename. ends_with ( ".rmeta" ) ) )
851
851
{
852
852
continue ;
853
853
}
@@ -905,7 +905,7 @@ pub fn run_cargo(
905
905
for ( prefix, extension, expected_len) in toplevel {
906
906
let candidates = contents. iter ( ) . filter ( |& & ( _, ref filename, ref meta) | {
907
907
filename. starts_with ( & prefix[ ..] )
908
- && filename[ prefix. len ( ) ..] . starts_with ( "-" )
908
+ && filename[ prefix. len ( ) ..] . starts_with ( '-' )
909
909
&& filename. ends_with ( & extension[ ..] )
910
910
&& meta. len ( ) == expected_len
911
911
} ) ;
0 commit comments