@@ -168,7 +168,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
168168 src_base : opt_path ( matches, "src-base" ) ,
169169 build_base : opt_path ( matches, "build-base" ) ,
170170 stage_id : matches. opt_str ( "stage-id" ) . unwrap ( ) ,
171- mode : matches. opt_str ( "mode" ) . unwrap ( ) . parse ( ) . ok ( ) . expect ( "invalid mode" ) ,
171+ mode : matches. opt_str ( "mode" ) . unwrap ( ) . parse ( ) . expect ( "invalid mode" ) ,
172172 run_ignored : matches. opt_present ( "ignored" ) ,
173173 filter : matches. free . first ( ) . cloned ( ) ,
174174 filter_exact : matches. opt_present ( "exact" ) ,
@@ -208,7 +208,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
208208
209209pub fn log_config ( config : & Config ) {
210210 let c = config;
211- logv ( c, format ! ( "configuration:" ) ) ;
211+ logv ( c, "configuration:" . to_string ( ) ) ;
212212 logv ( c, format ! ( "compile_lib_path: {:?}" , config. compile_lib_path) ) ;
213213 logv ( c, format ! ( "run_lib_path: {:?}" , config. run_lib_path) ) ;
214214 logv ( c, format ! ( "rustc_path: {:?}" , config. rustc_path. display( ) ) ) ;
@@ -238,10 +238,10 @@ pub fn log_config(config: &Config) {
238238 config. adb_device_status) ) ;
239239 logv ( c, format ! ( "verbose: {}" , config. verbose) ) ;
240240 logv ( c, format ! ( "quiet: {}" , config. quiet) ) ;
241- logv ( c, format ! ( "\n " ) ) ;
241+ logv ( c, "\n " . to_string ( ) ) ;
242242}
243243
244- pub fn opt_str < ' a > ( maybestr : & ' a Option < String > ) -> & ' a str {
244+ pub fn opt_str ( maybestr : & Option < String > ) -> & str {
245245 match * maybestr {
246246 None => "(none)" ,
247247 Some ( ref s) => s,
@@ -465,11 +465,9 @@ pub fn make_test(config: &Config, testpaths: &TestPaths) -> test::TestDescAndFn
465465 } ;
466466
467467 // Debugging emscripten code doesn't make sense today
468- let mut ignore = early_props. ignore || !up_to_date ( config, testpaths, & early_props) ;
469- if ( config. mode == DebugInfoGdb || config. mode == DebugInfoLldb ) &&
470- config. target . contains ( "emscripten" ) {
471- ignore = true ;
472- }
468+ let ignore = early_props. ignore || !up_to_date ( config, testpaths, & early_props) ||
469+ ( config. mode == DebugInfoGdb || config. mode == DebugInfoLldb ) &&
470+ config. target . contains ( "emscripten" ) ;
473471
474472 test:: TestDescAndFn {
475473 desc : test:: TestDesc {
@@ -487,7 +485,7 @@ fn stamp(config: &Config, testpaths: &TestPaths) -> PathBuf {
487485 . to_str( ) . unwrap( ) ,
488486 config. stage_id) ;
489487 config. build_base . canonicalize ( )
490- . unwrap_or ( config. build_base . clone ( ) )
488+ . unwrap_or_else ( |_| config. build_base . clone ( ) )
491489 . join ( stamp_name)
492490}
493491
@@ -512,7 +510,7 @@ fn up_to_date(config: &Config, testpaths: &TestPaths, props: &EarlyProps) -> boo
512510fn mtime ( path : & Path ) -> FileTime {
513511 fs:: metadata ( path) . map ( |f| {
514512 FileTime :: from_last_modification_time ( & f)
515- } ) . unwrap_or ( FileTime :: zero ( ) )
513+ } ) . unwrap_or_else ( |_| FileTime :: zero ( ) )
516514}
517515
518516pub fn make_test_name ( config : & Config , testpaths : & TestPaths ) -> test:: TestName {
@@ -560,7 +558,7 @@ fn analyze_gdb(gdb: Option<String>) -> (Option<String>, Option<u32>, bool) {
560558
561559 let gdb_native_rust = version. map_or ( false , |v| v >= MIN_GDB_WITH_RUST ) ;
562560
563- return ( Some ( gdb. to_owned ( ) ) , version, gdb_native_rust) ;
561+ ( Some ( gdb. to_owned ( ) ) , version, gdb_native_rust)
564562}
565563
566564fn extract_gdb_version ( full_version_line : & str ) -> Option < u32 > {
@@ -600,7 +598,7 @@ fn extract_gdb_version(full_version_line: &str) -> Option<u32> {
600598 Some ( idx) => if line. as_bytes ( ) [ idx] == b'.' {
601599 let patch = & line[ idx + 1 ..] ;
602600
603- let patch_len = patch. find ( |c : char | !c. is_digit ( 10 ) ) . unwrap_or ( patch. len ( ) ) ;
601+ let patch_len = patch. find ( |c : char | !c. is_digit ( 10 ) ) . unwrap_or_else ( || patch. len ( ) ) ;
604602 let patch = & patch[ ..patch_len] ;
605603 let patch = if patch_len > 3 || patch_len == 0 { None } else { Some ( patch) } ;
606604
0 commit comments