1
Fork 0

Rollup merge of #76888 - matthiaskrgr:clippy_single_match_2, r=Dylan-DPC

use if let instead of single match arm expressions

use if let instead of single match arm expressions to compact code and reduce nesting (clippy::single_match)
This commit is contained in:
ecstatic-morse 2020-09-21 20:40:55 -07:00 committed by GitHub
commit dcf4d1f2be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 28 additions and 58 deletions

View file

@ -488,18 +488,16 @@ impl<'tcx> Visitor<'tcx> for HirTraitObjectVisitor {
}
fn visit_ty(&mut self, t: &'tcx hir::Ty<'tcx>) {
match t.kind {
TyKind::TraitObject(
poly_trait_refs,
Lifetime { name: LifetimeName::ImplicitObjectLifetimeDefault, .. },
) => {
for ptr in poly_trait_refs {
if Some(self.1) == ptr.trait_ref.trait_def_id() {
self.0.push(ptr.span);
}
if let TyKind::TraitObject(
poly_trait_refs,
Lifetime { name: LifetimeName::ImplicitObjectLifetimeDefault, .. },
) = t.kind
{
for ptr in poly_trait_refs {
if Some(self.1) == ptr.trait_ref.trait_def_id() {
self.0.push(ptr.span);
}
}
_ => {}
}
walk_ty(self, t);
}