Skip to content

Commit 567bea2

Browse files
committed
Fix into_iter_without_iter false positive when the implementation is not within the first impl block
1 parent c412528 commit 567bea2

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

clippy_utils/src/ty.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,15 +1336,13 @@ pub fn get_adt_inherent_method<'a>(cx: &'a LateContext<'_>, ty: Ty<'_>, method_n
13361336
.inherent_impls(ty_did)
13371337
.into_iter()
13381338
.flatten()
1339-
.map(|&did| {
1339+
.find_map(|&did| {
13401340
cx.tcx
13411341
.associated_items(did)
13421342
.filter_by_name_unhygienic(method_name)
13431343
.next()
13441344
.filter(|item| item.kind == AssocKind::Fn)
13451345
})
1346-
.next()
1347-
.flatten()
13481346
} else {
13491347
None
13501348
}

0 commit comments

Comments
 (0)