Closed
Description
What it does
Given a use of a format macro, suggest to use the format!("{x}")
syntax when applicable.
Lint Name
format_args_capture
Category
pedantic
Advantage
- Code is shorter and more readable
- Increases awareness of the new syntax
Drawbacks
- Increases MSRV for projects that care about that
Example
let x = 2;
println!("{}", x);
println!("{x}", x = x);
println!("{y}", y = x); // untouched because variable name doesn't match
Could be written as:
let x = 2;
println!("{x}");
println!("{x}");
println!("{y}", y = x); // untouched because variable name doesn't match