2 Checks for unnecessary calls to [`ToOwned::to_owned`](https://doc.rust-lang.org/std/borrow/trait.ToOwned.html#tymethod.to_owned)
3 and other `to_owned`-like functions.
6 The unnecessary calls result in useless allocations.
9 `unnecessary_to_owned` can falsely trigger if `IntoIterator::into_iter` is applied to an
10 owned copy of a resource and the resource is later used mutably. See
11 [#8148](https://github.com/rust-lang/rust-clippy/issues/8148).
15 let path = std::path::Path::new("x");
16 foo(&path.to_string_lossy().to_string());
21 let path = std::path::Path::new("x");
22 foo(&path.to_string_lossy());