Skip to content

Commit 912a4dd

Browse files
authored
Edition 2021, apply clippy::uninlined_format_args fix (#1339)
1 parent b585b64 commit 912a4dd

File tree

28 files changed

+229
-241
lines changed

28 files changed

+229
-241
lines changed

crates/assert-instr-macro/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "assert-instr-macro"
33
version = "0.1.0"
44
authors = ["Alex Crichton <[email protected]>"]
5-
edition = "2018"
5+
edition = "2021"
66

77
[lib]
88
proc-macro = true

crates/assert-instr-macro/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ pub fn assert_instr(
5656
.replace('/', "_")
5757
.replace(':', "_")
5858
.replace(char::is_whitespace, "");
59-
let assert_name = syn::Ident::new(&format!("assert_{}_{}", name, instr_str), name.span());
59+
let assert_name = syn::Ident::new(&format!("assert_{name}_{instr_str}"), name.span());
6060
// These name has to be unique enough for us to find it in the disassembly later on:
6161
let shim_name = syn::Ident::new(
62-
&format!("stdarch_test_shim_{}_{}", name, instr_str),
62+
&format!("stdarch_test_shim_{name}_{instr_str}"),
6363
name.span(),
6464
);
6565
let shim_name_ptr = syn::Ident::new(
66-
&format!("stdarch_test_shim_{}_{}_ptr", name, instr_str).to_ascii_uppercase(),
66+
&format!("stdarch_test_shim_{name}_{instr_str}_ptr").to_ascii_uppercase(),
6767
name.span(),
6868
);
6969
let mut inputs = Vec::new();
@@ -131,7 +131,7 @@ pub fn assert_instr(
131131
} else {
132132
syn::LitStr::new("C", proc_macro2::Span::call_site())
133133
};
134-
let shim_name_str = format!("{}{}", shim_name, assert_name);
134+
let shim_name_str = format!("{shim_name}{assert_name}");
135135
let to_test = if disable_dedup_guard {
136136
quote! {
137137
#attrs

crates/core_arch/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ readme = "README.md"
1313
keywords = ["core", "simd", "arch", "intrinsics"]
1414
categories = ["hardware-support", "no-std"]
1515
license = "MIT OR Apache-2.0"
16-
edition = "2018"
16+
edition = "2021"
1717

1818
[badges]
1919
is-it-maintained-issue-resolution = { repository = "rust-lang/stdarch" }

crates/intrinsic-test/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "intrinsic-test"
33
version = "0.1.0"
44
authors = ["Jamie Cunliffe <[email protected]>"]
5-
edition = "2018"
5+
edition = "2021"
66

77
[dependencies]
88
lazy_static = "1.4.0"
@@ -14,4 +14,4 @@ log = "0.4.11"
1414
pretty_env_logger = "0.4.0"
1515
rayon = "1.5.0"
1616
diff = "0.1.12"
17-
itertools = "0.10.1"
17+
itertools = "0.10.1"

crates/intrinsic-test/src/acle_csv_parser.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ impl Into<Intrinsic> for ACLEIntrinsicLine {
5959
let signature = self.intrinsic;
6060
let (ret_ty, remaining) = signature.split_once(' ').unwrap();
6161

62-
let results = type_from_c(ret_ty)
63-
.unwrap_or_else(|_| panic!("Failed to parse return type: {}", ret_ty));
62+
let results =
63+
type_from_c(ret_ty).unwrap_or_else(|_| panic!("Failed to parse return type: {ret_ty}"));
6464

6565
let (name, args) = remaining.split_once('(').unwrap();
6666
let args = args.trim_end_matches(')');
@@ -177,7 +177,7 @@ fn from_c(pos: usize, s: &str) -> Argument {
177177
Argument {
178178
pos,
179179
name,
180-
ty: type_from_c(s).unwrap_or_else(|_| panic!("Failed to parse type: {}", s)),
180+
ty: type_from_c(s).unwrap_or_else(|_| panic!("Failed to parse type: {s}")),
181181
constraints: vec![],
182182
}
183183
}

crates/intrinsic-test/src/intrinsic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl Intrinsic {
109109
pub fn generate_loop_rust(&self, additional: &str, passes: u32) -> String {
110110
let constraints = self.arguments.as_constraint_parameters_rust();
111111
let constraints = if !constraints.is_empty() {
112-
format!("::<{}>", constraints)
112+
format!("::<{constraints}>")
113113
} else {
114114
constraints
115115
};

crates/intrinsic-test/src/main.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ fn gen_code_c(
5858
pass = gen_code_c(
5959
intrinsic,
6060
constraints,
61-
format!("{}-{}", name, i),
61+
format!("{name}-{i}"),
6262
p64_armv7_workaround
6363
)
6464
)
@@ -117,7 +117,7 @@ int main(int argc, char **argv) {{
117117
}}"#,
118118
header_files = header_files
119119
.iter()
120-
.map(|header| format!("#include <{}>", header))
120+
.map(|header| format!("#include <{header}>"))
121121
.collect::<Vec<_>>()
122122
.join("\n"),
123123
arglists = intrinsic.arguments.gen_arglists_c(PASSES),
@@ -148,7 +148,7 @@ fn gen_code_rust(intrinsic: &Intrinsic, constraints: &[&Argument], name: String)
148148
name = current.name,
149149
ty = current.ty.rust_type(),
150150
val = i,
151-
pass = gen_code_rust(intrinsic, constraints, format!("{}-{}", name, i))
151+
pass = gen_code_rust(intrinsic, constraints, format!("{name}-{i}"))
152152
)
153153
})
154154
.collect()
@@ -237,7 +237,7 @@ fn build_rust(intrinsics: &Vec<Intrinsic>, toolchain: &str, a32: bool) -> bool {
237237
intrinsics.iter().for_each(|i| {
238238
let rust_dir = format!(r#"rust_programs/{}"#, i.name);
239239
let _ = std::fs::create_dir_all(&rust_dir);
240-
let rust_filename = format!(r#"{}/main.rs"#, rust_dir);
240+
let rust_filename = format!(r#"{rust_dir}/main.rs"#);
241241
let mut file = File::create(&rust_filename).unwrap();
242242

243243
let c_code = generate_rust_program(&i, a32);
@@ -355,7 +355,7 @@ fn main() {
355355
let filename = matches.value_of("INPUT").unwrap();
356356
let toolchain = matches
357357
.value_of("TOOLCHAIN")
358-
.map_or("".into(), |t| format!("+{}", t));
358+
.map_or("".into(), |t| format!("+{t}"));
359359

360360
let cpp_compiler = matches.value_of("CPPCOMPILER").unwrap();
361361
let c_runner = matches.value_of("RUNNER").unwrap_or("");
@@ -443,7 +443,7 @@ fn compare_outputs(intrinsics: &Vec<Intrinsic>, toolchain: &str, runner: &str, a
443443

444444
let (c, rust) = match (c, rust) {
445445
(Ok(c), Ok(rust)) => (c, rust),
446-
a => panic!("{:#?}", a),
446+
a => panic!("{a:#?}"),
447447
};
448448

449449
if !c.status.success() {
@@ -480,20 +480,20 @@ fn compare_outputs(intrinsics: &Vec<Intrinsic>, toolchain: &str, runner: &str, a
480480

481481
intrinsics.iter().for_each(|reason| match reason {
482482
FailureReason::Difference(intrinsic, c, rust) => {
483-
println!("Difference for intrinsic: {}", intrinsic);
483+
println!("Difference for intrinsic: {intrinsic}");
484484
let diff = diff::lines(c, rust);
485485
diff.iter().for_each(|diff| match diff {
486-
diff::Result::Left(c) => println!("C: {}", c),
487-
diff::Result::Right(rust) => println!("Rust: {}", rust),
486+
diff::Result::Left(c) => println!("C: {c}"),
487+
diff::Result::Right(rust) => println!("Rust: {rust}"),
488488
diff::Result::Both(_, _) => (),
489489
});
490490
println!("****************************************************************");
491491
}
492492
FailureReason::RunC(intrinsic) => {
493-
println!("Failed to run C program for intrinsic {}", intrinsic)
493+
println!("Failed to run C program for intrinsic {intrinsic}")
494494
}
495495
FailureReason::RunRust(intrinsic) => {
496-
println!("Failed to run rust program for intrinsic {}", intrinsic)
496+
println!("Failed to run rust program for intrinsic {intrinsic}")
497497
}
498498
});
499499
println!("{} differences found", intrinsics.len());

crates/intrinsic-test/src/types.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ impl FromStr for TypeKind {
2525
"poly" => Ok(Self::Poly),
2626
"uint" | "unsigned" => Ok(Self::UInt),
2727
"void" => Ok(Self::Void),
28-
_ => Err(format!("Impossible to parse argument kind {}", s)),
28+
_ => Err(format!("Impossible to parse argument kind {s}")),
2929
}
3030
}
3131
}
@@ -199,14 +199,14 @@ impl IntrinsicType {
199199
simd_len: Some(simd_len),
200200
vec_len: None,
201201
..
202-
} => format!("{}{}x{}_t", kind.c_prefix(), bit_len, simd_len),
202+
} => format!("{}{bit_len}x{simd_len}_t", kind.c_prefix()),
203203
IntrinsicType::Type {
204204
kind,
205205
bit_len: Some(bit_len),
206206
simd_len: Some(simd_len),
207207
vec_len: Some(vec_len),
208208
..
209-
} => format!("{}{}x{}x{}_t", kind.c_prefix(), bit_len, simd_len, vec_len),
209+
} => format!("{}{bit_len}x{simd_len}x{vec_len}_t", kind.c_prefix()),
210210
_ => todo!("{:#?}", self),
211211
}
212212
}
@@ -220,7 +220,7 @@ impl IntrinsicType {
220220
simd_len: Some(simd_len),
221221
vec_len: Some(_),
222222
..
223-
} => format!("{}{}x{}_t", kind.c_prefix(), bit_len, simd_len),
223+
} => format!("{}{bit_len}x{simd_len}_t", kind.c_prefix()),
224224
_ => unreachable!("Shouldn't be called on this type"),
225225
}
226226
}
@@ -234,21 +234,21 @@ impl IntrinsicType {
234234
simd_len: None,
235235
vec_len: None,
236236
..
237-
} => format!("{}{}", kind.rust_prefix(), bit_len),
237+
} => format!("{}{bit_len}", kind.rust_prefix()),
238238
IntrinsicType::Type {
239239
kind,
240240
bit_len: Some(bit_len),
241241
simd_len: Some(simd_len),
242242
vec_len: None,
243243
..
244-
} => format!("{}{}x{}_t", kind.c_prefix(), bit_len, simd_len),
244+
} => format!("{}{bit_len}x{simd_len}_t", kind.c_prefix()),
245245
IntrinsicType::Type {
246246
kind,
247247
bit_len: Some(bit_len),
248248
simd_len: Some(simd_len),
249249
vec_len: Some(vec_len),
250250
..
251-
} => format!("{}{}x{}x{}_t", kind.c_prefix(), bit_len, simd_len, vec_len),
251+
} => format!("{}{bit_len}x{simd_len}x{vec_len}_t", kind.c_prefix()),
252252
_ => todo!("{:#?}", self),
253253
}
254254
}

crates/intrinsic-test/src/values.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub fn value_for_array(bits: u32, index: u32) -> String {
1313
} else if bits == 64 {
1414
format!("{:#X}", VALUES_64[index % VALUES_64.len()])
1515
} else {
16-
panic!("Unknown size: {}", bits);
16+
panic!("Unknown size: {bits}");
1717
}
1818
}
1919

crates/simd-test-macro/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "simd-test-macro"
33
version = "0.1.0"
44
authors = ["Alex Crichton <[email protected]>"]
5-
edition = "2018"
5+
edition = "2021"
66

77
[lib]
88
proc-macro = true

0 commit comments

Comments
 (0)