mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
Inline all format arguments where possible
This makes code more readale and concise, moving all format arguments like `format!("{}", foo)` into the more compact `format!("{foo}")` form. The change was automatically created with, so there are far less change of an accidental typo. ``` cargo clippy --fix -- -A clippy::all -W clippy::uninlined_format_args ```
This commit is contained in:
parent
1927c2e1d8
commit
e16c76e3c3
180 changed files with 487 additions and 501 deletions
|
@ -238,7 +238,7 @@ impl ProfileStack {
|
|||
self.heartbeat(frame.heartbeats);
|
||||
let avg_span = duration / (frame.heartbeats + 1);
|
||||
if avg_span > self.filter.heartbeat_longer_than {
|
||||
eprintln!("Too few heartbeats {} ({}/{:?})?", label, frame.heartbeats, duration);
|
||||
eprintln!("Too few heartbeats {label} ({}/{duration:?})?", frame.heartbeats);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -275,7 +275,7 @@ fn print(
|
|||
out: &mut impl Write,
|
||||
) {
|
||||
let current_indent = " ".repeat(level as usize);
|
||||
let detail = tree[curr].detail.as_ref().map(|it| format!(" @ {}", it)).unwrap_or_default();
|
||||
let detail = tree[curr].detail.as_ref().map(|it| format!(" @ {it}")).unwrap_or_default();
|
||||
writeln!(
|
||||
out,
|
||||
"{}{} - {}{}",
|
||||
|
@ -302,13 +302,13 @@ fn print(
|
|||
}
|
||||
|
||||
for (child_msg, (duration, count)) in &short_children {
|
||||
writeln!(out, " {}{} - {} ({} calls)", current_indent, ms(*duration), child_msg, count)
|
||||
writeln!(out, " {current_indent}{} - {child_msg} ({count} calls)", ms(*duration))
|
||||
.expect("printing profiling info");
|
||||
}
|
||||
|
||||
let unaccounted = tree[curr].duration - accounted_for;
|
||||
if tree.children(curr).next().is_some() && unaccounted > longer_than {
|
||||
writeln!(out, " {}{} - ???", current_indent, ms(unaccounted))
|
||||
writeln!(out, " {current_indent}{} - ???", ms(unaccounted))
|
||||
.expect("printing profiling info");
|
||||
}
|
||||
}
|
||||
|
@ -320,7 +320,7 @@ impl fmt::Display for ms {
|
|||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self.0.as_millis() {
|
||||
0 => f.write_str(" 0 "),
|
||||
n => write!(f, "{:5}ms", n),
|
||||
n => write!(f, "{n:5}ms"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue