@@ -18,7 +18,6 @@ use std::str;
1818use build_helper:: { output, t, up_to_date} ;
1919use filetime:: FileTime ;
2020use serde:: Deserialize ;
21- use serde_json;
2221
2322use crate :: builder:: Cargo ;
2423use crate :: dist;
@@ -149,7 +148,8 @@ fn copy_third_party_objects(
149148 // which is provided by std for this target.
150149 if target == "x86_64-fortanix-unknown-sgx" {
151150 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) ) ;
153153 copy_and_stamp ( Path :: new ( & src) , "libunwind.a" ) ;
154154 }
155155
@@ -361,7 +361,7 @@ impl Step for StartupObjects {
361361 ) ;
362362 }
363363
364- let target = sysroot_dir. join ( file. to_string ( ) + ".o" ) ;
364+ let target = sysroot_dir. join ( ( * file) . to_string ( ) + ".o" ) ;
365365 builder. copy ( dst_file, & target) ;
366366 target_deps. push ( target) ;
367367 }
@@ -515,7 +515,7 @@ pub fn rustc_cargo_env(builder: &Builder<'_>, cargo: &mut Cargo, target: Interne
515515 . env ( "CFG_VERSION" , builder. rust_version ( ) )
516516 . env ( "CFG_PREFIX" , builder. config . prefix . clone ( ) . unwrap_or_default ( ) ) ;
517517
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" ) ) ;
519519 cargo. env ( "CFG_LIBDIR_RELATIVE" , libdir_relative) ;
520520
521521 if let Some ( ref ver_date) = builder. rust_info . commit_date ( ) {
@@ -843,11 +843,11 @@ pub fn run_cargo(
843843 } ;
844844 for filename in filenames {
845845 // 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" ) ) )
851851 {
852852 continue ;
853853 }
@@ -905,7 +905,7 @@ pub fn run_cargo(
905905 for ( prefix, extension, expected_len) in toplevel {
906906 let candidates = contents. iter ( ) . filter ( |& & ( _, ref filename, ref meta) | {
907907 filename. starts_with ( & prefix[ ..] )
908- && filename[ prefix. len ( ) ..] . starts_with ( "-" )
908+ && filename[ prefix. len ( ) ..] . starts_with ( '-' )
909909 && filename. ends_with ( & extension[ ..] )
910910 && meta. len ( ) == expected_len
911911 } ) ;
0 commit comments