Skip to content

Commit d4eb81e

Browse files
committed
Apply clippy::uninlined_format_args fix
1 parent 7b7c103 commit d4eb81e

File tree

7 files changed

+24
-25
lines changed

7 files changed

+24
-25
lines changed

build.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ fn build_android() {
2929
Ok(result) => result,
3030
Err(e) => {
3131
eprintln!(
32-
"warning: android version detection failed while running C compiler: {}",
33-
e
32+
"warning: android version detection failed while running C compiler: {e}",
3433
);
3534
return;
3635
}
@@ -39,7 +38,7 @@ fn build_android() {
3938
Ok(s) => s,
4039
Err(_) => return,
4140
};
42-
eprintln!("expanded android version detection:\n{}", expansion);
41+
eprintln!("expanded android version detection:\n{expansion}");
4342
let i = match expansion.find(MARKER) {
4443
Some(i) => i,
4544
None => return,

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
@@ -239,7 +239,7 @@ impl BacktraceFrameFmt<'_, '_, '_> {
239239
if self.symbol_index == 0 {
240240
write!(self.fmt.fmt, "{:4}: ", self.fmt.frame_index)?;
241241
if let PrintFmt::Full = self.fmt.format {
242-
write!(self.fmt.fmt, "{:1$?} - ", frame_ip, HEX_WIDTH)?;
242+
write!(self.fmt.fmt, "{frame_ip:HEX_WIDTH$?} - ")?;
243243
}
244244
} else {
245245
write!(self.fmt.fmt, " ")?;
@@ -252,8 +252,8 @@ impl BacktraceFrameFmt<'_, '_, '_> {
252252
// more information if we're a full backtrace. Here we also handle
253253
// symbols which don't have a name,
254254
match (symbol_name, &self.fmt.format) {
255-
(Some(name), PrintFmt::Short) => write!(self.fmt.fmt, "{:#}", name)?,
256-
(Some(name), PrintFmt::Full) => write!(self.fmt.fmt, "{}", name)?,
255+
(Some(name), PrintFmt::Short) => write!(self.fmt.fmt, "{name:#}")?,
256+
(Some(name), PrintFmt::Full) => write!(self.fmt.fmt, "{name}")?,
257257
(None, _) | (_, PrintFmt::__Nonexhaustive) => write!(self.fmt.fmt, "<unknown>")?,
258258
}
259259
self.fmt.fmt.write_str("\n")?;
@@ -275,18 +275,18 @@ impl BacktraceFrameFmt<'_, '_, '_> {
275275
// Filename/line are printed on lines under the symbol name, so print
276276
// some appropriate whitespace to sort of right-align ourselves.
277277
if let PrintFmt::Full = self.fmt.format {
278-
write!(self.fmt.fmt, "{:1$}", "", HEX_WIDTH)?;
278+
write!(self.fmt.fmt, "{:HEX_WIDTH$}", "")?;
279279
}
280280
write!(self.fmt.fmt, " at ")?;
281281

282282
// Delegate to our internal callback to print the filename and then
283283
// print out the line number.
284284
(self.fmt.print_path)(self.fmt.fmt, file)?;
285-
write!(self.fmt.fmt, ":{}", line)?;
285+
write!(self.fmt.fmt, ":{line}")?;
286286

287287
// Add column number, if available.
288288
if let Some(colno) = colno {
289-
write!(self.fmt.fmt, ":{}", colno)?;
289+
write!(self.fmt.fmt, ":{colno}")?;
290290
}
291291

292292
write!(self.fmt.fmt, "\n")?;
@@ -297,7 +297,7 @@ impl BacktraceFrameFmt<'_, '_, '_> {
297297
// We only care about the first symbol of a frame
298298
if self.symbol_index == 0 {
299299
self.fmt.fmt.write_str("{{{bt:")?;
300-
write!(self.fmt.fmt, "{}:{:?}", self.fmt.frame_index, frame_ip)?;
300+
write!(self.fmt.fmt, "{}:{frame_ip:?}", self.fmt.frame_index)?;
301301
self.fmt.fmt.write_str("}}}\n")?;
302302
}
303303
Ok(())

tests/accuracy/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ fn verify(filelines: &[Pos]) {
9696
println!("-----------------------------------");
9797
println!("looking for:");
9898
for (file, line) in filelines.iter().rev() {
99-
println!("\t{}:{}", file, line);
99+
println!("\t{file}:{line}");
100100
}
101-
println!("found:\n{:?}", trace);
101+
println!("found:\n{trace:?}");
102102
let mut symbols = trace.frames().iter().flat_map(|frame| frame.symbols());
103103
let mut iter = filelines.iter().rev();
104104
while let Some((file, line)) = iter.next() {

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
@@ -111,16 +111,16 @@ fn smoke_test_frames() {
111111
backtrace::resolve_frame(frame, |sym| {
112112
print!("symbol ip:{:?} address:{:?} ", frame.ip(), frame.symbol_address());
113113
if let Some(name) = sym.name() {
114-
print!("name:{} ", name);
114+
print!("name:{name} ");
115115
}
116116
if let Some(file) = sym.filename() {
117117
print!("file:{} ", file.display());
118118
}
119119
if let Some(lineno) = sym.lineno() {
120-
print!("lineno:{} ", lineno);
120+
print!("lineno:{lineno} ");
121121
}
122122
if let Some(colno) = sym.colno() {
123-
print!("colno:{} ", colno);
123+
print!("colno:{colno} ");
124124
}
125125
println!();
126126
});
@@ -268,12 +268,12 @@ fn sp_smoke_test() {
268268

269269
if refs.len() < 5 {
270270
recursive_stack_references(refs);
271-
eprintln!("exiting: {}", x);
271+
eprintln!("exiting: {x}");
272272
return;
273273
}
274274

275275
backtrace::trace(make_trace_closure(refs));
276-
eprintln!("exiting: {}", x);
276+
eprintln!("exiting: {x}");
277277
}
278278

279279
// NB: the following `make_*` functions are pulled out of line, rather than
@@ -295,7 +295,7 @@ fn sp_smoke_test() {
295295
sym.name()
296296
.and_then(|name| name.as_str())
297297
.map_or(false, |name| {
298-
eprintln!("name = {}", name);
298+
eprintln!("name = {name}");
299299
name.contains("recursive_stack_references")
300300
})
301301
});

0 commit comments

Comments
 (0)