Auto merge of #87449 - matthiaskrgr:clippyy_v2, r=nagisa

more clippy::complexity fixes

(also a couple of clippy::perf fixes)
This commit is contained in:
bors
2021-08-01 09:15:15 +00:00
32 changed files with 44 additions and 51 deletions

View File

@@ -124,11 +124,10 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
self.impl_similar_to(trait_ref, obligation).unwrap_or_else(|| trait_ref.def_id());
let trait_ref = trait_ref.skip_binder();
let mut flags = vec![];
flags.push((
let mut flags = vec![(
sym::ItemContext,
self.describe_enclosure(obligation.cause.body_id).map(|s| s.to_owned()),
));
)];
match obligation.cause.code {
ObligationCauseCode::BuiltinDerivedObligation(..)

View File

@@ -290,13 +290,9 @@ fn suggest_restriction(
} else {
// Trivial case: `T` needs an extra bound: `T: Bound`.
let (sp, suggestion) = match (
generics
.params
.iter()
.filter(|p| {
!matches!(p.kind, hir::GenericParamKind::Type { synthetic: Some(_), .. })
})
.next(),
generics.params.iter().find(|p| {
!matches!(p.kind, hir::GenericParamKind::Type { synthetic: Some(_), .. })
}),
super_traits,
) {
(_, None) => predicate_constraint(