about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAstra Tsai <astra@ucsc.edu>2024-07-01 18:57:24 -0700
committerAstra Tsai <astra@ucsc.edu>2024-07-01 18:57:24 -0700
commit567bea29b14e0365bddbd8b5f0ee9f49c8ea7e72 (patch)
tree972ab500c5b21075d5e6d5bdda3bb6153fd9ec5b
parentc4125286cea8a4dcbb5df0e05f0d968a7d0c59d0 (diff)
downloadrust-567bea29b14e0365bddbd8b5f0ee9f49c8ea7e72.tar.gz
rust-567bea29b14e0365bddbd8b5f0ee9f49c8ea7e72.zip
Fix `into_iter_without_iter` false positive when the implementation is not within the first `impl` block
-rw-r--r--clippy_utils/src/ty.rs4
1 files changed, 1 insertions, 3 deletions
diff --git a/clippy_utils/src/ty.rs b/clippy_utils/src/ty.rs
index e5d20564196..b0c842f9850 100644
--- a/clippy_utils/src/ty.rs
+++ b/clippy_utils/src/ty.rs
@@ -1336,15 +1336,13 @@ pub fn get_adt_inherent_method<'a>(cx: &'a LateContext<'_>, ty: Ty<'_>, method_n
             .inherent_impls(ty_did)
             .into_iter()
             .flatten()
-            .map(|&did| {
+            .find_map(|&did| {
                 cx.tcx
                     .associated_items(did)
                     .filter_by_name_unhygienic(method_name)
                     .next()
                     .filter(|item| item.kind == AssocKind::Fn)
             })
-            .next()
-            .flatten()
     } else {
         None
     }