mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-07 17:18:32 +03:00
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.
This commit is contained in:
@@ -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 \
|
||||
|
||||
Reference in New Issue
Block a user