Skip to content

Commit

Permalink
Minor refactor for rustc_resolve diagnostics match
Browse files Browse the repository at this point in the history
Use `matches!` instead of old `if let`
  • Loading branch information
pickfire authored Jul 10, 2020
1 parent e59b08e commit 1fb0ed0
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/librustc_resolve/late/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 1fb0ed0

Please sign in to comment.