From 366234a515ab6538c83e5b58481b2c45abd72d76 Mon Sep 17 00:00:00 2001 From: "Samuel E. Moelius III" Date: Sat, 8 Jan 2022 09:09:52 -0500 Subject: [PATCH] Add `unnecessary_to_owned` "Known problems" section --- clippy_lints/src/methods/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/clippy_lints/src/methods/mod.rs b/clippy_lints/src/methods/mod.rs index 4e33b2ff1..6572c7111 100644 --- a/clippy_lints/src/methods/mod.rs +++ b/clippy_lints/src/methods/mod.rs @@ -1895,6 +1895,11 @@ declare_clippy_lint! { /// ### 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 /// ```rust /// let path = std::path::Path::new("x");