Closed
Description
Description
Playground link: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=810bfbe41db9fada1864da9143f8f4e5
#![warn(clippy::str_to_string)]
fn main() {
let _ = "foo".to_string();
}
warning: `to_string()` called on a `&str`
--> src/main.rs:4:13
|
4 | let _ = "foo".to_string();
| ^^^^^^^^^^^^^^^^^
|
= help: consider using `.to_owned()`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#str_to_string
note: the lint level is defined here
This feels like a great fit for a machine applicable fix.
Version
$ rustc -Vv
rustc 1.77.2 (25ef9e3d8 2024-04-09)
binary: rustc
commit-hash: 25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04
commit-date: 2024-04-09
host: x86_64-unknown-linux-gnu
release: 1.77.2
LLVM version: 17.0.6
Additional Labels
C-enhancement