diff options
Diffstat (limited to 'src/tools/clippy/src/docs/unnecessary_to_owned.txt')
-rw-r--r-- | src/tools/clippy/src/docs/unnecessary_to_owned.txt | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/src/tools/clippy/src/docs/unnecessary_to_owned.txt b/src/tools/clippy/src/docs/unnecessary_to_owned.txt deleted file mode 100644 index 5d4213bda..000000000 --- a/src/tools/clippy/src/docs/unnecessary_to_owned.txt +++ /dev/null @@ -1,24 +0,0 @@ -### What it does -Checks for unnecessary calls to [`ToOwned::to_owned`](https://doc.rust-lang.org/std/borrow/trait.ToOwned.html#tymethod.to_owned) -and other `to_owned`-like functions. - -### Why is this bad? -The unnecessary calls result in useless allocations. - -### Known problems -`unnecessary_to_owned` can falsely trigger if `IntoIterator::into_iter` is applied to an -owned copy of a resource and the resource is later used mutably. See -[#8148](https://github.com/rust-lang/rust-clippy/issues/8148). - -### Example -``` -let path = std::path::Path::new("x"); -foo(&path.to_string_lossy().to_string()); -fn foo(s: &str) {} -``` -Use instead: -``` -let path = std::path::Path::new("x"); -foo(&path.to_string_lossy()); -fn foo(s: &str) {} -```
\ No newline at end of file |