Use .any(x) instead of .find(x).is_some() on iterators.

This commit is contained in:
Matthias Krüger 2020-03-02 20:01:03 +01:00
parent c287d86d2c
commit ae34b9d996
2 changed files with 6 additions and 10 deletions

View File

@ -236,8 +236,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// //
// FIXME? Other potential candidate methods: `as_ref` and // FIXME? Other potential candidate methods: `as_ref` and
// `as_mut`? // `as_mut`?
.find(|a| a.check_name(sym::rustc_conversion_suggestion)) .any(|a| a.check_name(sym::rustc_conversion_suggestion))
.is_some()
}); });
methods methods

View File

@ -23,14 +23,11 @@ impl InherentOverlapChecker<'tcx> {
let impl_items2 = self.tcx.associated_items(impl2); let impl_items2 = self.tcx.associated_items(impl2);
for item1 in impl_items1.in_definition_order() { for item1 in impl_items1.in_definition_order() {
let collision = impl_items2 let collision = impl_items2.filter_by_name_unhygienic(item1.ident.name).any(|item2| {
.filter_by_name_unhygienic(item1.ident.name) // Symbols and namespace match, compare hygienically.
.find(|item2| { item1.kind.namespace() == item2.kind.namespace()
// Symbols and namespace match, compare hygienically. && item1.ident.modern() == item2.ident.modern()
item1.kind.namespace() == item2.kind.namespace() });
&& item1.ident.modern() == item2.ident.modern()
})
.is_some();
if collision { if collision {
return true; return true;