Skip to content

Commit 049d0af

Browse files
authored
Merge pull request #4416 from nyurik/inline-fmt-arg
chore: inline format args
2 parents 0fe1d45 + 444d9df commit 049d0af

File tree

8 files changed

+142
-147
lines changed

8 files changed

+142
-147
lines changed

build.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,17 @@ fn main() {
124124
if rustc_minor_ver >= 80 {
125125
for cfg in ALLOWED_CFGS {
126126
if rustc_minor_ver >= 75 {
127-
println!("cargo:rustc-check-cfg=cfg({})", cfg);
127+
println!("cargo:rustc-check-cfg=cfg({cfg})");
128128
} else {
129-
println!("cargo:rustc-check-cfg=values({})", cfg);
129+
println!("cargo:rustc-check-cfg=values({cfg})");
130130
}
131131
}
132132
for &(name, values) in CHECK_CFG_EXTRA {
133133
let values = values.join("\",\"");
134134
if rustc_minor_ver >= 75 {
135-
println!("cargo:rustc-check-cfg=cfg({},values(\"{}\"))", name, values);
135+
println!("cargo:rustc-check-cfg=cfg({name},values(\"{values}\"))");
136136
} else {
137-
println!("cargo:rustc-check-cfg=values({},\"{}\")", name, values);
137+
println!("cargo:rustc-check-cfg=values({name},\"{values}\")");
138138
}
139139
}
140140
}
@@ -255,7 +255,7 @@ fn emcc_version_code() -> Option<u64> {
255255

256256
fn set_cfg(cfg: &str) {
257257
if !ALLOWED_CFGS.contains(&cfg) {
258-
panic!("trying to set cfg {}, but it is not in ALLOWED_CFGS", cfg);
258+
panic!("trying to set cfg {cfg}, but it is not in ALLOWED_CFGS");
259259
}
260-
println!("cargo:rustc-cfg={}", cfg);
260+
println!("cargo:rustc-cfg={cfg}");
261261
}

ci/ios/deploy_and_run_on_ios_simulator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use std::process::Command;
1616
macro_rules! t {
1717
($e:expr) => (match $e {
1818
Ok(e) => e,
19-
Err(e) => panic!("{} failed with: {}", stringify!($e), e),
19+
Err(e) => panic!("{} failed with: {e}", stringify!($e)),
2020
})
2121
}
2222

@@ -143,7 +143,7 @@ trait CheckStatus {
143143

144144
impl CheckStatus for Command {
145145
fn check_status(&mut self) {
146-
println!("\trunning: {:?}", self);
146+
println!("\trunning: {self:?}");
147147
assert!(t!(self.status()).success());
148148
}
149149
}

ci/runtest-android.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ fn main() {
3737
let stderr = String::from_utf8_lossy(&output.stderr);
3838

3939
println!(
40-
"status: {}\nstdout ---\n{}\nstderr ---\n{}",
41-
output.status, stdout, stderr
40+
"status: {}\nstdout ---\n{stdout}\nstderr ---\n{stderr}",
41+
output.status,
4242
);
4343

4444
if !stderr.lines().any(|l| {

ctest-test/build.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ fn main() {
3030
.type_name(move |ty, is_struct, is_union| match ty {
3131
"T1Union" => ty.to_string(),
3232
"Transparent" => ty.to_string(),
33-
t if is_struct => format!("struct {}", t),
34-
t if is_union => format!("union {}", t),
33+
t if is_struct => format!("struct {t}"),
34+
t if is_union => format!("union {t}"),
3535
t => t.to_string(),
3636
})
3737
.volatile_item(t1_volatile)
@@ -43,8 +43,8 @@ fn main() {
4343
.include("src")
4444
.type_name(move |ty, is_struct, is_union| match ty {
4545
"T2Union" => ty.to_string(),
46-
t if is_struct => format!("struct {}", t),
47-
t if is_union => format!("union {}", t),
46+
t if is_struct => format!("struct {t}"),
47+
t if is_union => format!("union {t}"),
4848
t => t.to_string(),
4949
})
5050
.skip_roundtrip(|_| true)
@@ -64,8 +64,8 @@ fn main() {
6464
.type_name(move |ty, is_struct, is_union| match ty {
6565
"T1Union" => ty.to_string(),
6666
"Transparent" => ty.to_string(),
67-
t if is_struct => format!("struct {}", t),
68-
t if is_union => format!("union {}", t),
67+
t if is_struct => format!("struct {t}"),
68+
t if is_union => format!("union {t}"),
6969
t => t.to_string(),
7070
})
7171
.volatile_item(t1_volatile)
@@ -78,8 +78,8 @@ fn main() {
7878
.include("src")
7979
.type_name(move |ty, is_struct, is_union| match ty {
8080
"T2Union" => ty.to_string(),
81-
t if is_struct => format!("struct {}", t),
82-
t if is_union => format!("union {}", t),
81+
t if is_struct => format!("struct {t}"),
82+
t if is_union => format!("union {t}"),
8383
t => t.to_string(),
8484
})
8585
.skip_roundtrip(|_| true)

ctest-test/tests/all.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ fn output(cmd: &mut Command) -> (String, ExitStatus) {
2828
fn t1() {
2929
let (o, status) = output(&mut cmd("t1"));
3030
assert!(status.success(), "output: {o}");
31-
assert!(!o.contains("bad "), "{}", o);
32-
eprintln!("o: {}", o);
31+
assert!(!o.contains("bad "), "{o}");
32+
eprintln!("o: {o}");
3333
}
3434

3535
#[test]
3636
#[cfg(has_cxx)]
3737
fn t1_cxx() {
3838
let (o, status) = output(&mut cmd("t1_cxx"));
3939
assert!(status.success(), "output: {o}");
40-
assert!(!o.contains("bad "), "{}", o);
40+
assert!(!o.contains("bad "), "{o}");
4141
}
4242

4343
#[test]
@@ -69,17 +69,17 @@ fn t2() {
6969
for line in o.lines().filter(|l| l.starts_with("bad ")) {
7070
let msg = &line[..line.find(":").unwrap()];
7171
if !errors.remove(&msg) {
72-
println!("unknown error: {}", msg);
72+
println!("unknown error: {msg}");
7373
bad = true;
7474
}
7575
}
7676

7777
for error in errors {
78-
println!("didn't find error: {}", error);
78+
println!("didn't find error: {error}");
7979
bad = true;
8080
}
8181
if bad {
82-
println!("output was:\n\n{}", o);
82+
println!("output was:\n\n{o}");
8383
panic!();
8484
}
8585
}
@@ -114,17 +114,17 @@ fn t2_cxx() {
114114
for line in o.lines().filter(|l| l.starts_with("bad ")) {
115115
let msg = &line[..line.find(":").unwrap()];
116116
if !errors.remove(&msg) {
117-
println!("unknown error: {}", msg);
117+
println!("unknown error: {msg}");
118118
bad = true;
119119
}
120120
}
121121

122122
for error in errors {
123-
println!("didn't find error: {}", error);
123+
println!("didn't find error: {error}");
124124
bad = true;
125125
}
126126
if bad {
127-
println!("output was:\n\n{}", o);
127+
println!("output was:\n\n{o}");
128128
panic!();
129129
}
130130
}

0 commit comments

Comments
 (0)