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
// `as_mut`?
.find(|a| a.check_name(sym::rustc_conversion_suggestion))
.is_some()
.any(|a| a.check_name(sym::rustc_conversion_suggestion))
});
methods

View File

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