From 567bea29b14e0365bddbd8b5f0ee9f49c8ea7e72 Mon Sep 17 00:00:00 2001 From: Astra Tsai Date: Mon, 1 Jul 2024 18:57:24 -0700 Subject: [PATCH] Fix `into_iter_without_iter` false positive when the implementation is not within the first `impl` block --- clippy_utils/src/ty.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/clippy_utils/src/ty.rs b/clippy_utils/src/ty.rs index e5d205641..b0c842f98 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 }