diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2020-12-24 02:55:21 +0100 |
|---|---|---|
| committer | Matthias Krüger <matthias.krueger@famsik.de> | 2020-12-24 13:35:12 +0100 |
| commit | d12a358673b17ed74fe1a584b4cab66fe62e18d0 (patch) | |
| tree | 4e2431f555f0dd3fa5df51ac629470f8112c01cd /compiler/rustc_parse | |
| parent | c34c015fe2710caf53ba7ae9d1644f9ba65a6f74 (diff) | |
| download | rust-d12a358673b17ed74fe1a584b4cab66fe62e18d0.tar.gz rust-d12a358673b17ed74fe1a584b4cab66fe62e18d0.zip | |
use matches!() macro in more places
Diffstat (limited to 'compiler/rustc_parse')
| -rw-r--r-- | compiler/rustc_parse/src/parser/path.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/compiler/rustc_parse/src/parser/path.rs b/compiler/rustc_parse/src/parser/path.rs index 4510e86e034..60a47ca12b8 100644 --- a/compiler/rustc_parse/src/parser/path.rs +++ b/compiler/rustc_parse/src/parser/path.rs @@ -501,10 +501,9 @@ impl<'a> Parser<'a> { pub(super) fn expr_is_valid_const_arg(&self, expr: &P<rustc_ast::Expr>) -> bool { match &expr.kind { ast::ExprKind::Block(_, _) | ast::ExprKind::Lit(_) => true, - ast::ExprKind::Unary(ast::UnOp::Neg, expr) => match &expr.kind { - ast::ExprKind::Lit(_) => true, - _ => false, - }, + ast::ExprKind::Unary(ast::UnOp::Neg, expr) => { + matches!(expr.kind, ast::ExprKind::Lit(_)) + } // We can only resolve single-segment paths at the moment, because multi-segment paths // require type-checking: see `visit_generic_arg` in `src/librustc_resolve/late.rs`. ast::ExprKind::Path(None, path) |
