1
Fork 0

more clippy::complexity fixes

redundant_guards
      redundant_slicing
      filter_next
      needless_borrowed_reference
      useless_format
This commit is contained in:
Matthias Krüger 2023-12-12 20:41:51 +01:00
parent 27d8a57713
commit 3795cc8eb0
10 changed files with 18 additions and 28 deletions

View file

@ -1063,12 +1063,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
initial_binding.res()
});
let res = binding.res();
let has_ambiguity_error = this
.ambiguity_errors
.iter()
.filter(|error| !error.warning)
.next()
.is_some();
let has_ambiguity_error =
this.ambiguity_errors.iter().any(|error| !error.warning);
if res == Res::Err || has_ambiguity_error {
this.tcx
.sess

View file

@ -1829,13 +1829,12 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
)
.iter()
.filter_map(|candidate| candidate.did)
.filter(|did| {
.find(|did| {
self.r
.tcx
.get_attrs(*did, sym::rustc_diagnostic_item)
.any(|attr| attr.value_str() == Some(sym::Default))
})
.next();
});
let Some(default_trait) = default_trait else {
return;
};
@ -1880,11 +1879,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
};
fields.is_some_and(|fields| {
fields
.iter()
.filter(|vis| !self.r.is_accessible_from(**vis, self.parent_scope.module))
.next()
.is_some()
fields.iter().any(|vis| !self.r.is_accessible_from(*vis, self.parent_scope.module))
})
}