@@ -34,7 +34,7 @@ fn output_file_suffix(testfile: &Path, bit_width: u32, panic_strategy: PanicStra
34
34
35
35
let mut suffix = String :: new ( ) ;
36
36
if each_bit_width {
37
- suffix. push_str ( & format ! ( ".{}bit" , bit_width ) ) ;
37
+ suffix. push_str ( & format ! ( ".{bit_width }bit" ) ) ;
38
38
}
39
39
if each_panic_strategy {
40
40
match panic_strategy {
@@ -51,7 +51,7 @@ pub fn files_for_miropt_test(
51
51
panic_strategy : PanicStrategy ,
52
52
) -> MiroptTest {
53
53
let mut out = Vec :: new ( ) ;
54
- let test_file_contents = fs:: read_to_string ( & testfile) . unwrap ( ) ;
54
+ let test_file_contents = fs:: read_to_string ( testfile) . unwrap ( ) ;
55
55
56
56
let test_dir = testfile. parent ( ) . unwrap ( ) ;
57
57
let test_crate = testfile. file_stem ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) . replace ( '-' , "_" ) ;
@@ -76,10 +76,10 @@ pub fn files_for_miropt_test(
76
76
77
77
if test_name. ends_with ( ".diff" ) {
78
78
let trimmed = test_name. trim_end_matches ( ".diff" ) ;
79
- passes. push ( trimmed. split ( '.' ) . last ( ) . unwrap ( ) . to_owned ( ) ) ;
80
- let test_against = format ! ( "{}.after.mir" , trimmed ) ;
81
- from_file = format ! ( "{}.before.mir" , trimmed ) ;
82
- expected_file = format ! ( "{}{ }.diff" , trimmed , suffix ) ;
79
+ passes. push ( trimmed. split ( '.' ) . next_back ( ) . unwrap ( ) . to_owned ( ) ) ;
80
+ let test_against = format ! ( "{trimmed }.after.mir" ) ;
81
+ from_file = format ! ( "{trimmed }.before.mir" ) ;
82
+ expected_file = format ! ( "{trimmed}{suffix }.diff" ) ;
83
83
assert ! ( test_names. next( ) . is_none( ) , "two mir pass names specified for MIR diff" ) ;
84
84
to_file = Some ( test_against) ;
85
85
} else if let Some ( first_pass) = test_names. next ( ) {
@@ -92,10 +92,9 @@ pub fn files_for_miropt_test(
92
92
}
93
93
assert ! ( test_names. next( ) . is_none( ) , "three mir pass names specified for MIR diff" ) ;
94
94
95
- expected_file =
96
- format ! ( "{}{}.{}-{}.diff" , test_name, suffix, first_pass, second_pass) ;
97
- let second_file = format ! ( "{}.{}.mir" , test_name, second_pass) ;
98
- from_file = format ! ( "{}.{}.mir" , test_name, first_pass) ;
95
+ expected_file = format ! ( "{test_name}{suffix}.{first_pass}-{second_pass}.diff" ) ;
96
+ let second_file = format ! ( "{test_name}.{second_pass}.mir" ) ;
97
+ from_file = format ! ( "{test_name}.{first_pass}.mir" ) ;
99
98
to_file = Some ( second_file) ;
100
99
} else {
101
100
// Allow-list for file extensions that can be produced by MIR dumps.
@@ -112,7 +111,7 @@ pub fn files_for_miropt_test(
112
111
)
113
112
}
114
113
115
- expected_file = format ! ( "{}{ }.{}" , test_name_wo_ext , suffix , test_name_ext ) ;
114
+ expected_file = format ! ( "{test_name_wo_ext}{suffix }.{test_name_ext}" ) ;
116
115
from_file = test_name. to_string ( ) ;
117
116
assert ! ( test_names. next( ) . is_none( ) , "two mir pass names specified for MIR dump" ) ;
118
117
to_file = None ;
@@ -123,7 +122,7 @@ pub fn files_for_miropt_test(
123
122
) ;
124
123
} ;
125
124
if !expected_file. starts_with ( & test_crate) {
126
- expected_file = format ! ( "{}.{}" , test_crate , expected_file ) ;
125
+ expected_file = format ! ( "{test_crate }.{expected_file}" ) ;
127
126
}
128
127
let expected_file = test_dir. join ( expected_file) ;
129
128
0 commit comments