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:
Yuri Astrakhan 2022-12-23 13:42:58 -05:00
parent 1927c2e1d8
commit e16c76e3c3
180 changed files with 487 additions and 501 deletions

View file

@ -115,15 +115,15 @@ fn print_debug_subtree(f: &mut fmt::Formatter<'_>, subtree: &Subtree, level: usi
let aux = match subtree.delimiter.map(|it| (it.kind, it.id.0)) {
None => "$".to_string(),
Some((DelimiterKind::Parenthesis, id)) => format!("() {}", id),
Some((DelimiterKind::Brace, id)) => format!("{{}} {}", id),
Some((DelimiterKind::Bracket, id)) => format!("[] {}", id),
Some((DelimiterKind::Parenthesis, id)) => format!("() {id}"),
Some((DelimiterKind::Brace, id)) => format!("{{}} {id}"),
Some((DelimiterKind::Bracket, id)) => format!("[] {id}"),
};
if subtree.token_trees.is_empty() {
write!(f, "{}SUBTREE {}", align, aux)?;
write!(f, "{align}SUBTREE {aux}")?;
} else {
writeln!(f, "{}SUBTREE {}", align, aux)?;
writeln!(f, "{align}SUBTREE {aux}")?;
for (idx, child) in subtree.token_trees.iter().enumerate() {
print_debug_token(f, child, level + 1)?;
if idx != subtree.token_trees.len() - 1 {
@ -140,7 +140,7 @@ fn print_debug_token(f: &mut fmt::Formatter<'_>, tkn: &TokenTree, level: usize)
match tkn {
TokenTree::Leaf(leaf) => match leaf {
Leaf::Literal(lit) => write!(f, "{}LITERAL {} {}", align, lit.text, lit.id.0)?,
Leaf::Literal(lit) => write!(f, "{align}LITERAL {} {}", lit.text, lit.id.0)?,
Leaf::Punct(punct) => write!(
f,
"{}PUNCH {} [{}] {}",
@ -149,7 +149,7 @@ fn print_debug_token(f: &mut fmt::Formatter<'_>, tkn: &TokenTree, level: usize)
if punct.spacing == Spacing::Alone { "alone" } else { "joint" },
punct.id.0
)?,
Leaf::Ident(ident) => write!(f, "{}IDENT {} {}", align, ident.text, ident.id.0)?,
Leaf::Ident(ident) => write!(f, "{align}IDENT {} {}", ident.text, ident.id.0)?,
},
TokenTree::Subtree(subtree) => {
print_debug_subtree(f, subtree, level)?;
@ -312,7 +312,7 @@ pub fn pretty(tkns: &[TokenTree]) -> String {
Some(DelimiterKind::Parenthesis) => ("(", ")"),
Some(DelimiterKind::Bracket) => ("[", "]"),
};
format!("{}{}{}", open, content, close)
format!("{open}{content}{close}")
}
}
}