mirror of
https://github.com/rust-lang/rust-clippy
synced 2025-02-17 06:28:42 +00:00
Add .as_ref() to suggestion to remove .to_string() The case of `.to_owned().split(…)` is treated specially in the `unnecessary_to_owned` lint. Test cases check that it works both for slices and for strings, but they missed a corner case: `x.to_string().split(…)` when `x` implements `AsRef<str>` but not `Deref<Target = str>`. In this case, it is wrong to suggest to remove `.to_string()` without adding `.as_ref()` instead. Fix #12068 changelog: [`unnecessary_to_owned`]: suggest replacing `.to_string()` by `.as_ref()` |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
README.md |