Skip to content

Commit 3579c93

Browse files
authored
Unrolled build for #144300
Rollup merge of #144300 - hkBst:clippy-fix-7, r=Mark-Simulacrum Clippy fixes for miropt-test-tools
2 parents d242a8b + 39ef6a9 commit 3579c93

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "miropt-test-tools"
33
version = "0.1.0"
4-
edition = "2021"
4+
edition = "2024"
55

66
[dependencies]

src/tools/miropt-test-tools/src/lib.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fn output_file_suffix(testfile: &Path, bit_width: u32, panic_strategy: PanicStra
3434

3535
let mut suffix = String::new();
3636
if each_bit_width {
37-
suffix.push_str(&format!(".{}bit", bit_width));
37+
suffix.push_str(&format!(".{bit_width}bit"));
3838
}
3939
if each_panic_strategy {
4040
match panic_strategy {
@@ -51,7 +51,7 @@ pub fn files_for_miropt_test(
5151
panic_strategy: PanicStrategy,
5252
) -> MiroptTest {
5353
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();
5555

5656
let test_dir = testfile.parent().unwrap();
5757
let test_crate = testfile.file_stem().unwrap().to_str().unwrap().replace('-', "_");
@@ -76,10 +76,10 @@ pub fn files_for_miropt_test(
7676

7777
if test_name.ends_with(".diff") {
7878
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");
8383
assert!(test_names.next().is_none(), "two mir pass names specified for MIR diff");
8484
to_file = Some(test_against);
8585
} else if let Some(first_pass) = test_names.next() {
@@ -92,10 +92,9 @@ pub fn files_for_miropt_test(
9292
}
9393
assert!(test_names.next().is_none(), "three mir pass names specified for MIR diff");
9494

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");
9998
to_file = Some(second_file);
10099
} else {
101100
// Allow-list for file extensions that can be produced by MIR dumps.
@@ -112,7 +111,7 @@ pub fn files_for_miropt_test(
112111
)
113112
}
114113

115-
expected_file = format!("{}{}.{}", test_name_wo_ext, suffix, test_name_ext);
114+
expected_file = format!("{test_name_wo_ext}{suffix}.{test_name_ext}");
116115
from_file = test_name.to_string();
117116
assert!(test_names.next().is_none(), "two mir pass names specified for MIR dump");
118117
to_file = None;
@@ -123,7 +122,7 @@ pub fn files_for_miropt_test(
123122
);
124123
};
125124
if !expected_file.starts_with(&test_crate) {
126-
expected_file = format!("{}.{}", test_crate, expected_file);
125+
expected_file = format!("{test_crate}.{expected_file}");
127126
}
128127
let expected_file = test_dir.join(expected_file);
129128

0 commit comments

Comments
 (0)