-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when appliedIssue: The suggestions provided by this Lint cause an ICE/error when appliedP-highPriority: HighPriority: High
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
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when appliedIssue: The suggestions provided by this Lint cause an ICE/error when appliedP-highPriority: HighPriority: High