From 1fb0ed0e2ce788d8f69969bdb81967ca3c9a7f26 Mon Sep 17 00:00:00 2001 From: Ivan Tham Date: Fri, 10 Jul 2020 15:36:02 +0800 Subject: [PATCH] Minor refactor for rustc_resolve diagnostics match Use `matches!` instead of old `if let` --- src/librustc_resolve/late/diagnostics.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/librustc_resolve/late/diagnostics.rs b/src/librustc_resolve/late/diagnostics.rs index e469ca80c590a..e26ff13f5c93b 100644 --- a/src/librustc_resolve/late/diagnostics.rs +++ b/src/librustc_resolve/late/diagnostics.rs @@ -100,9 +100,7 @@ impl<'a> LateResolutionVisitor<'a, '_, '_> { let ident_span = path.last().map_or(span, |ident| ident.ident.span); let ns = source.namespace(); let is_expected = &|res| source.is_expected(res); - let is_enum_variant = &|res| { - if let Res::Def(DefKind::Variant, _) = res { true } else { false } - }; + let is_enum_variant = &|res| matches!(res, Res::Def(DefKind::Variant, _)); // Make the base error. let expected = source.descr_expected();