Skip to content

Commit 9172eb4

Browse files
committed
Apply clippy::uninlined_format_args fix
1 parent e1c49fb commit 9172eb4

File tree

7 files changed

+25
-25
lines changed

7 files changed

+25
-25
lines changed

build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ fn build_android() {
1313
let expansion = match cc::Build::new().file("src/android-api.c").try_expand() {
1414
Ok(result) => result,
1515
Err(e) => {
16-
println!("failed to run C compiler: {}", e);
16+
println!("failed to run C compiler: {e}");
1717
return;
1818
}
1919
};
2020
let expansion = match std::str::from_utf8(&expansion) {
2121
Ok(s) => s,
2222
Err(_) => return,
2323
};
24-
println!("expanded android version detection:\n{}", expansion);
24+
println!("expanded android version detection:\n{expansion}");
2525
let marker = "APIVERSION";
2626
let i = match expansion.find(marker) {
2727
Some(i) => i,

crates/cpp_smoke_test/tests/smoke.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ fn smoke_test_cpp() {
4949
.take(2)
5050
.collect();
5151

52-
println!("actual names = {:#?}", names);
52+
println!("actual names = {names:#?}");
5353

5454
let expected = [
5555
"void space::templated_trampoline<void (*)()>(void (*)())",
5656
"cpp_trampoline",
5757
];
58-
println!("expected names = {:#?}", expected);
58+
println!("expected names = {expected:#?}");
5959

6060
assert_eq!(names.len(), expected.len());
6161
for (actual, expected) in names.iter().zip(expected.iter()) {

examples/raw.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fn print() {
2121
let mut cnt = 0;
2222
backtrace::trace(|frame| {
2323
let ip = frame.ip();
24-
print!("frame #{:<2} - {:#02$x}", cnt, ip as usize, HEX_WIDTH);
24+
print!("frame #{cnt:<2} - {:#0HEX_WIDTH$x}", ip as usize);
2525
cnt += 1;
2626

2727
let mut resolved = false;
@@ -33,13 +33,13 @@ fn print() {
3333
}
3434

3535
if let Some(name) = symbol.name() {
36-
print!(" - {}", name);
36+
print!(" - {name}");
3737
} else {
3838
print!(" - <unknown>");
3939
}
4040
if let Some(file) = symbol.filename() {
4141
if let Some(l) = symbol.lineno() {
42-
print!("\n{:13}{:4$}@ {}:{}", "", "", file.display(), l, HEX_WIDTH);
42+
print!("\n{:13}{:HEX_WIDTH$}@ {}:{l}", "", "", file.display());
4343
}
4444
}
4545
println!("");

src/print.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ impl BacktraceFrameFmt<'_, '_, '_> {
247247
if self.symbol_index == 0 {
248248
write!(self.fmt.fmt, "{:4}: ", self.fmt.frame_index)?;
249249
if let PrintFmt::Full = self.fmt.format {
250-
write!(self.fmt.fmt, "{:1$?} - ", frame_ip, HEX_WIDTH)?;
250+
write!(self.fmt.fmt, "{frame_ip:HEX_WIDTH$?} - ")?;
251251
}
252252
} else {
253253
write!(self.fmt.fmt, " ")?;
@@ -260,8 +260,8 @@ impl BacktraceFrameFmt<'_, '_, '_> {
260260
// more information if we're a full backtrace. Here we also handle
261261
// symbols which don't have a name,
262262
match (symbol_name, &self.fmt.format) {
263-
(Some(name), PrintFmt::Short) => write!(self.fmt.fmt, "{:#}", name)?,
264-
(Some(name), PrintFmt::Full) => write!(self.fmt.fmt, "{}", name)?,
263+
(Some(name), PrintFmt::Short) => write!(self.fmt.fmt, "{name:#}")?,
264+
(Some(name), PrintFmt::Full) => write!(self.fmt.fmt, "{name}")?,
265265
(None, _) | (_, PrintFmt::__Nonexhaustive) => write!(self.fmt.fmt, "<unknown>")?,
266266
}
267267
self.fmt.fmt.write_str("\n")?;
@@ -283,18 +283,18 @@ impl BacktraceFrameFmt<'_, '_, '_> {
283283
// Filename/line are printed on lines under the symbol name, so print
284284
// some appropriate whitespace to sort of right-align ourselves.
285285
if let PrintFmt::Full = self.fmt.format {
286-
write!(self.fmt.fmt, "{:1$}", "", HEX_WIDTH)?;
286+
write!(self.fmt.fmt, "{:HEX_WIDTH$}", "")?;
287287
}
288288
write!(self.fmt.fmt, " at ")?;
289289

290290
// Delegate to our internal callback to print the filename and then
291291
// print out the line number.
292292
(self.fmt.print_path)(self.fmt.fmt, file)?;
293-
write!(self.fmt.fmt, ":{}", line)?;
293+
write!(self.fmt.fmt, ":{line}")?;
294294

295295
// Add column number, if available.
296296
if let Some(colno) = colno {
297-
write!(self.fmt.fmt, ":{}", colno)?;
297+
write!(self.fmt.fmt, ":{colno}")?;
298298
}
299299

300300
write!(self.fmt.fmt, "\n")?;
@@ -305,7 +305,7 @@ impl BacktraceFrameFmt<'_, '_, '_> {
305305
// We only care about the first symbol of a frame
306306
if self.symbol_index == 0 {
307307
self.fmt.fmt.write_str("{{{bt:")?;
308-
write!(self.fmt.fmt, "{}:{:?}", self.fmt.frame_index, frame_ip)?;
308+
write!(self.fmt.fmt, "{}:{frame_ip:?}", self.fmt.frame_index)?;
309309
self.fmt.fmt.write_str("}}}\n")?;
310310
}
311311
Ok(())

tests/accuracy/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,16 @@ fn verify(filelines: &[Pos]) {
9494
println!("-----------------------------------");
9595
println!("looking for:");
9696
for (file, line) in filelines.iter().rev() {
97-
println!("\t{}:{}", file, line);
97+
println!("\t{file}:{line}");
9898
}
99-
println!("found:\n{:?}", trace);
99+
println!("found:\n{trace:?}");
100100
let mut symbols = trace.frames().iter().flat_map(|frame| frame.symbols());
101101
let mut iter = filelines.iter().rev();
102102
while let Some((file, line)) = iter.next() {
103103
loop {
104104
let sym = match symbols.next() {
105105
Some(sym) => sym,
106-
None => panic!("failed to find {}:{}", file, line),
106+
None => panic!("{}", "failed to find {file}:{line}"),
107107
};
108108
if let Some(filename) = sym.filename() {
109109
if let Some(lineno) = sym.lineno() {

tests/skip_inner_frames.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ fn backtrace_new_unresolved_should_start_with_call_site_trace() {
1818
}
1919
let mut b = Backtrace::new_unresolved();
2020
b.resolve();
21-
println!("{:?}", b);
21+
println!("{b:?}");
2222

2323
assert!(!b.frames().is_empty());
2424

@@ -34,7 +34,7 @@ fn backtrace_new_should_start_with_call_site_trace() {
3434
return;
3535
}
3636
let b = Backtrace::new();
37-
println!("{:?}", b);
37+
println!("{b:?}");
3838

3939
assert!(!b.frames().is_empty());
4040

tests/smoke.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,16 @@ fn smoke_test_frames() {
9090
backtrace::resolve_frame(frame, |sym| {
9191
print!("symbol ip:{:?} address:{:?} ", frame.ip(), frame.symbol_address());
9292
if let Some(name) = sym.name() {
93-
print!("name:{} ", name);
93+
print!("name:{name} ");
9494
}
9595
if let Some(file) = sym.filename() {
9696
print!("file:{} ", file.display());
9797
}
9898
if let Some(lineno) = sym.lineno() {
99-
print!("lineno:{} ", lineno);
99+
print!("lineno:{lineno} ");
100100
}
101101
if let Some(colno) = sym.colno() {
102-
print!("colno:{} ", colno);
102+
print!("colno:{colno} ");
103103
}
104104
println!();
105105
});
@@ -257,12 +257,12 @@ fn sp_smoke_test() {
257257

258258
if refs.len() < 5 {
259259
recursive_stack_references(refs);
260-
eprintln!("exiting: {}", x);
260+
eprintln!("exiting: {x}");
261261
return;
262262
}
263263

264264
backtrace::trace(make_trace_closure(refs));
265-
eprintln!("exiting: {}", x);
265+
eprintln!("exiting: {x}");
266266
}
267267

268268
// NB: the following `make_*` functions are pulled out of line, rather than
@@ -284,7 +284,7 @@ fn sp_smoke_test() {
284284
sym.name()
285285
.and_then(|name| name.as_str())
286286
.map_or(false, |name| {
287-
eprintln!("name = {}", name);
287+
eprintln!("name = {name}");
288288
name.contains("recursive_stack_references")
289289
})
290290
});

0 commit comments

Comments
 (0)