]> git.lizzy.rs Git - rust.git/commitdiff
simplify match stmt
authorBastian Kauschke <bastian_kauschke@hotmail.de>
Thu, 26 Mar 2020 09:52:52 +0000 (10:52 +0100)
committerBastian Kauschke <bastian_kauschke@hotmail.de>
Thu, 26 Mar 2020 09:52:52 +0000 (10:52 +0100)
src/librustc_ast_passes/ast_validation.rs

index c03c44fc634cecd361b810f1593a6c4bb3dbaf20..d6d1153f2790f09e15695e705765dd8cfcb3f390 100644 (file)
@@ -289,11 +289,7 @@ fn check_expr_within_pat(&self, expr: &Expr, allow_paths: bool) {
         match expr.kind {
             ExprKind::Lit(..) | ExprKind::Err => {}
             ExprKind::Path(..) if allow_paths => {}
-            ExprKind::Unary(UnOp::Neg, ref inner)
-                if match inner.kind {
-                    ExprKind::Lit(_) => true,
-                    _ => false,
-                } => {}
+            ExprKind::Unary(UnOp::Neg, ref inner) if matches!(inner.kind, ExprKind::Lit(_)) => {}
             _ => self.err_handler().span_err(
                 expr.span,
                 "arbitrary expressions aren't allowed \