about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-12-28 14:13:12 +0100
committerGitHub <noreply@github.com>2020-12-28 14:13:12 +0100
commitc51172f38a901ab170432330dd943c5a9b1adb53 (patch)
tree18adf127fc83477a253f9987c5dc7cbb2f69c071 /compiler/rustc_parse/src/parser
parent3f8c979c4ba5ad7f749bbd883ad6f97747e2c07e (diff)
parentd12a358673b17ed74fe1a584b4cab66fe62e18d0 (diff)
downloadrust-c51172f38a901ab170432330dd943c5a9b1adb53.tar.gz
rust-c51172f38a901ab170432330dd943c5a9b1adb53.zip
Rollup merge of #80344 - matthiaskrgr:matches, r=Dylan-DPC
use matches!() macro in more places
Diffstat (limited to 'compiler/rustc_parse/src/parser')
-rw-r--r--compiler/rustc_parse/src/parser/path.rs7
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)