mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-21 11:23:03 +00: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:
commit
608715bbd1
@ -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 \
|
||||
|
Loading…
Reference in New Issue
Block a user