@@ -168,7 +168,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
168
168
src_base : opt_path ( matches, "src-base" ) ,
169
169
build_base : opt_path ( matches, "build-base" ) ,
170
170
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" ) ,
172
172
run_ignored : matches. opt_present ( "ignored" ) ,
173
173
filter : matches. free . first ( ) . cloned ( ) ,
174
174
filter_exact : matches. opt_present ( "exact" ) ,
@@ -208,7 +208,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
208
208
209
209
pub fn log_config ( config : & Config ) {
210
210
let c = config;
211
- logv ( c, format ! ( "configuration:" ) ) ;
211
+ logv ( c, "configuration:" . to_string ( ) ) ;
212
212
logv ( c, format ! ( "compile_lib_path: {:?}" , config. compile_lib_path) ) ;
213
213
logv ( c, format ! ( "run_lib_path: {:?}" , config. run_lib_path) ) ;
214
214
logv ( c, format ! ( "rustc_path: {:?}" , config. rustc_path. display( ) ) ) ;
@@ -238,10 +238,10 @@ pub fn log_config(config: &Config) {
238
238
config. adb_device_status) ) ;
239
239
logv ( c, format ! ( "verbose: {}" , config. verbose) ) ;
240
240
logv ( c, format ! ( "quiet: {}" , config. quiet) ) ;
241
- logv ( c, format ! ( "\n " ) ) ;
241
+ logv ( c, "\n " . to_string ( ) ) ;
242
242
}
243
243
244
- pub fn opt_str < ' a > ( maybestr : & ' a Option < String > ) -> & ' a str {
244
+ pub fn opt_str ( maybestr : & Option < String > ) -> & str {
245
245
match * maybestr {
246
246
None => "(none)" ,
247
247
Some ( ref s) => s,
@@ -465,11 +465,9 @@ pub fn make_test(config: &Config, testpaths: &TestPaths) -> test::TestDescAndFn
465
465
} ;
466
466
467
467
// 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" ) ;
473
471
474
472
test:: TestDescAndFn {
475
473
desc : test:: TestDesc {
@@ -488,7 +486,7 @@ fn stamp(config: &Config, testpaths: &TestPaths) -> PathBuf {
488
486
. to_str( ) . unwrap( ) ,
489
487
config. stage_id) ;
490
488
config. build_base . canonicalize ( )
491
- . unwrap_or ( config. build_base . clone ( ) )
489
+ . unwrap_or_else ( |_| config. build_base . clone ( ) )
492
490
. join ( stamp_name)
493
491
}
494
492
@@ -513,7 +511,7 @@ fn up_to_date(config: &Config, testpaths: &TestPaths, props: &EarlyProps) -> boo
513
511
fn mtime ( path : & Path ) -> FileTime {
514
512
fs:: metadata ( path) . map ( |f| {
515
513
FileTime :: from_last_modification_time ( & f)
516
- } ) . unwrap_or ( FileTime :: zero ( ) )
514
+ } ) . unwrap_or_else ( |_| FileTime :: zero ( ) )
517
515
}
518
516
519
517
pub fn make_test_name ( config : & Config , testpaths : & TestPaths ) -> test:: TestName {
@@ -561,7 +559,7 @@ fn analyze_gdb(gdb: Option<String>) -> (Option<String>, Option<u32>, bool) {
561
559
562
560
let gdb_native_rust = version. map_or ( false , |v| v >= MIN_GDB_WITH_RUST ) ;
563
561
564
- return ( Some ( gdb. to_owned ( ) ) , version, gdb_native_rust) ;
562
+ ( Some ( gdb. to_owned ( ) ) , version, gdb_native_rust)
565
563
}
566
564
567
565
fn extract_gdb_version ( full_version_line : & str ) -> Option < u32 > {
@@ -601,7 +599,8 @@ fn extract_gdb_version(full_version_line: &str) -> Option<u32> {
601
599
Some ( idx) => if line. as_bytes ( ) [ idx] == b'.' {
602
600
let patch = & line[ idx + 1 ..] ;
603
601
604
- let patch_len = patch. find ( |c : char | !c. is_digit ( 10 ) ) . unwrap_or ( patch. len ( ) ) ;
602
+ let patch_len = patch. find ( |c : char | !c. is_digit ( 10 ) )
603
+ . unwrap_or_else ( || patch. len ( ) ) ;
605
604
let patch = & patch[ ..patch_len] ;
606
605
let patch = if patch_len > 3 || patch_len == 0 { None } else { Some ( patch) } ;
607
606
0 commit comments