Skip to content

Commit ae34b9d

Browse files
committed
Use .any(x) instead of .find(x).is_some() on iterators.
1 parent c287d86 commit ae34b9d

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

src/librustc_typeck/check/demand.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
236236
//
237237
// FIXME? Other potential candidate methods: `as_ref` and
238238
// `as_mut`?
239-
.find(|a| a.check_name(sym::rustc_conversion_suggestion))
240-
.is_some()
239+
.any(|a| a.check_name(sym::rustc_conversion_suggestion))
241240
});
242241

243242
methods

src/librustc_typeck/coherence/inherent_impls_overlap.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,11 @@ impl InherentOverlapChecker<'tcx> {
2323
let impl_items2 = self.tcx.associated_items(impl2);
2424

2525
for item1 in impl_items1.in_definition_order() {
26-
let collision = impl_items2
27-
.filter_by_name_unhygienic(item1.ident.name)
28-
.find(|item2| {
29-
// Symbols and namespace match, compare hygienically.
30-
item1.kind.namespace() == item2.kind.namespace()
31-
&& item1.ident.modern() == item2.ident.modern()
32-
})
33-
.is_some();
26+
let collision = impl_items2.filter_by_name_unhygienic(item1.ident.name).any(|item2| {
27+
// Symbols and namespace match, compare hygienically.
28+
item1.kind.namespace() == item2.kind.namespace()
29+
&& item1.ident.modern() == item2.ident.modern()
30+
});
3431

3532
if collision {
3633
return true;

0 commit comments

Comments
 (0)