diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2020-03-26 13:32:20 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-26 13:32:20 +0100 |
| commit | 608715bbd10ec9a088d46f03db9afa689bfb3c90 (patch) | |
| tree | 45d6837d752b3628506e97f0ac317a258fa3619a /src | |
| parent | 37e186087c28891d04dd67c8657c9affc8cdc59a (diff) | |
| parent | c21e25c2622c2a7294189ddc545a0cb9c621631a (diff) | |
| download | rust-608715bbd10ec9a088d46f03db9afa689bfb3c90.tar.gz rust-608715bbd10ec9a088d46f03db9afa689bfb3c90.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_ast_passes/ast_validation.rs | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/librustc_ast_passes/ast_validation.rs b/src/librustc_ast_passes/ast_validation.rs index c03c44fc634..d6d1153f279 100644 --- a/src/librustc_ast_passes/ast_validation.rs +++ b/src/librustc_ast_passes/ast_validation.rs @@ -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 \ |
