Fix into_iter_without_iter false positive when the implementation is not within the first impl block

This commit is contained in:
Astra Tsai 2024-07-01 18:57:24 -07:00
parent c4125286ce
commit 567bea29b1

View File

@ -1336,15 +1336,13 @@ pub fn get_adt_inherent_method<'a>(cx: &'a LateContext<'_>, ty: Ty<'_>, method_n
.inherent_impls(ty_did) .inherent_impls(ty_did)
.into_iter() .into_iter()
.flatten() .flatten()
.map(|&did| { .find_map(|&did| {
cx.tcx cx.tcx
.associated_items(did) .associated_items(did)
.filter_by_name_unhygienic(method_name) .filter_by_name_unhygienic(method_name)
.next() .next()
.filter(|item| item.kind == AssocKind::Fn) .filter(|item| item.kind == AssocKind::Fn)
}) })
.next()
.flatten()
} else { } else {
None None
} }