Skip to content

Commit 608715b

Browse files
authored
Rollup merge of #70424 - lcnr:nit, r=Centril
simplify match stmt We actually have a surprising amount of ```rust match expr { $($p:pat)|+ => true, _ => false, } ``` While I would prefer this to be replaced with `matches!`, most cases are fairly readable anyway so we can just let them be for now.
2 parents 37e1860 + c21e25c commit 608715b

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/librustc_ast_passes/ast_validation.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -289,11 +289,7 @@ impl<'a> AstValidator<'a> {
289289
match expr.kind {
290290
ExprKind::Lit(..) | ExprKind::Err => {}
291291
ExprKind::Path(..) if allow_paths => {}
292-
ExprKind::Unary(UnOp::Neg, ref inner)
293-
if match inner.kind {
294-
ExprKind::Lit(_) => true,
295-
_ => false,
296-
} => {}
292+
ExprKind::Unary(UnOp::Neg, ref inner) if matches!(inner.kind, ExprKind::Lit(_)) => {}
297293
_ => self.err_handler().span_err(
298294
expr.span,
299295
"arbitrary expressions aren't allowed \

0 commit comments

Comments
 (0)