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

@ -144,8 +144,7 @@ pub(crate) fn render_field(
}
fn field_with_receiver(receiver: Option<&hir::Name>, field_name: &str) -> SmolStr {
receiver
.map_or_else(|| field_name.into(), |receiver| format!("{}.{}", receiver, field_name).into())
receiver.map_or_else(|| field_name.into(), |receiver| format!("{receiver}.{field_name}").into())
}
pub(crate) fn render_tuple_field(
@ -306,7 +305,7 @@ fn render_resolution_path(
item.lookup_by(name.clone())
.label(SmolStr::from_iter([&name, "<…>"]))
.trigger_call_info()
.insert_snippet(cap, format!("{}<$0>", local_name));
.insert_snippet(cap, format!("{local_name}<$0>"));
}
}
}
@ -528,13 +527,13 @@ mod tests {
let tag = it.kind().tag();
let relevance = display_relevance(it.relevance());
items.push(format!("{} {} {}\n", tag, it.label(), relevance));
items.push(format!("{tag} {} {relevance}\n", it.label()));
if let Some((mutability, _offset, relevance)) = it.ref_match() {
let label = format!("&{}{}", mutability.as_keyword_for_ref(), it.label());
let relevance = display_relevance(relevance);
items.push(format!("{} {} {}\n", tag, label, relevance));
items.push(format!("{tag} {label} {relevance}\n"));
}
items
@ -563,7 +562,7 @@ mod tests {
.filter_map(|(cond, desc)| if cond { Some(desc) } else { None })
.join("+");
format!("[{}]", relevance_factors)
format!("[{relevance_factors}]")
}
}