1
Fork 0

Rollup merge of #80344 - matthiaskrgr:matches, r=Dylan-DPC

use matches!() macro in more places
This commit is contained in:
Dylan DPC 2020-12-28 14:13:12 +01:00 committed by GitHub
commit c51172f38a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 137 additions and 266 deletions

View file

@ -1653,17 +1653,14 @@ impl<'tcx> LifetimeContext<'_, 'tcx> {
for missing in &self.missing_named_lifetime_spots {
match missing {
MissingLifetimeSpot::Generics(generics) => {
let (span, sugg) = if let Some(param) =
generics.params.iter().find(|p| match p.kind {
hir::GenericParamKind::Type {
synthetic: Some(hir::SyntheticTyParamKind::ImplTrait),
..
} => false,
hir::GenericParamKind::Lifetime {
kind: hir::LifetimeParamKind::Elided,
} => false,
_ => true,
}) {
let (span, sugg) = if let Some(param) = generics.params.iter().find(|p| {
!matches!(p.kind, hir::GenericParamKind::Type {
synthetic: Some(hir::SyntheticTyParamKind::ImplTrait),
..
} | hir::GenericParamKind::Lifetime {
kind: hir::LifetimeParamKind::Elided,
})
}) {
(param.span.shrink_to_lo(), format!("{}, ", lifetime_ref))
} else {
suggests_in_band = true;