mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +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
|
@ -328,7 +328,7 @@ fn generate_nodes(kinds: KindsSrc<'_>, grammar: &AstSrc) -> String {
|
|||
|
||||
fn write_doc_comment(contents: &[String], dest: &mut String) {
|
||||
for line in contents {
|
||||
writeln!(dest, "///{}", line).unwrap();
|
||||
writeln!(dest, "///{line}").unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -501,7 +501,7 @@ fn to_pascal_case(s: &str) -> String {
|
|||
}
|
||||
|
||||
fn pluralize(s: &str) -> String {
|
||||
format!("{}s", s)
|
||||
format!("{s}s")
|
||||
}
|
||||
|
||||
impl Field {
|
||||
|
@ -637,7 +637,7 @@ fn lower_rule(acc: &mut Vec<Field>, grammar: &Grammar, label: Option<&String>, r
|
|||
let mut name = grammar[*token].name.clone();
|
||||
if name != "int_number" && name != "string" {
|
||||
if "[]{}()".contains(&name) {
|
||||
name = format!("'{}'", name);
|
||||
name = format!("'{name}'");
|
||||
}
|
||||
let field = Field::Token(name);
|
||||
acc.push(field);
|
||||
|
@ -651,7 +651,7 @@ fn lower_rule(acc: &mut Vec<Field>, grammar: &Grammar, label: Option<&String>, r
|
|||
acc.push(field);
|
||||
return;
|
||||
}
|
||||
panic!("unhandled rule: {:?}", rule)
|
||||
panic!("unhandled rule: {rule:?}")
|
||||
}
|
||||
Rule::Labeled { label: l, rule } => {
|
||||
assert!(label.is_none());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue