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:
Mazdak Farrokhzad 2020-03-26 13:32:20 +01:00 committed by GitHub
commit 608715bbd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -289,11 +289,7 @@ impl<'a> AstValidator<'a> {
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 \