Closed
Description
Summary
Clippy does not yet understand fully understand format!("{x}");
yet.
This probably needs to be a msrv
lint.
Reproducer
I tried this code:
fn main() {
let x = "hello";
let _string = format!("{x}");
}
I expected to see this happen:
Clippy should suggest something like x.to_string()
but instead suggests {x}.to_string()
Instead, this happened:
warning: useless use of `format!`
--> src/main.rs:3:19
|
3 | let _string = format!("{x}");
| ^^^^^^^^^^^^^^ help: consider using `.to_string()`: `{x}.to_string()`
|
= note: `#[warn(clippy::useless_format)]` on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format
Version
`clippy 0.1.60 (38c22af 2022-01-15)`
Additional Labels
No response