Description
A common pattern format!("...{}...", "foo") has a number of related lints like:
we also have the uninlined_format_args which is more generic, but focuses on variables, not string literals.
I think these approaches should be combined, either as part of the uninlined_format_args, or as a new lint (and possibly sunset/remove the print/write literal?).
Mixed cases like format!("{}{}", foo, "bar") may cause issues with multiple lints trying to fix the same, so a single lint might be better, but uninlined_format_args focuses on vars, so expanding its scope might be confusing? Although technically this is also inlining an argument, so might be ok?
Version
rustc 1.69.0 (84c898d65 2023-04-16)
binary: rustc
commit-hash: 84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc
commit-date: 2023-04-16
host: x86_64-unknown-linux-gnu
release: 1.69.0
LLVM version: 15.0.7
Additional Labels
No response
Description
A common pattern
format!("...{}...", "foo")has a number of related lints like:println!("{}", "foo");writeln!(buf, "{}", "foo");we also have the uninlined_format_args which is more generic, but focuses on variables, not string literals.
I think these approaches should be combined, either as part of the
uninlined_format_args, or as a new lint (and possibly sunset/remove the print/write literal?).Mixed cases like
format!("{}{}", foo, "bar")may cause issues with multiple lints trying to fix the same, so a single lint might be better, but uninlined_format_args focuses on vars, so expanding its scope might be confusing? Although technically this is also inlining an argument, so might be ok?Version
Additional Labels
No response