Rollup merge of #80344 - matthiaskrgr:matches, r=Dylan-DPC
use matches!() macro in more places
This commit is contained in:
commit
c51172f38a
33 changed files with 137 additions and 266 deletions
|
@ -501,10 +501,9 @@ impl<'a> Parser<'a> {
|
|||
pub(super) fn expr_is_valid_const_arg(&self, expr: &P<rustc_ast::Expr>) -> bool {
|
||||
match &expr.kind {
|
||||
ast::ExprKind::Block(_, _) | ast::ExprKind::Lit(_) => true,
|
||||
ast::ExprKind::Unary(ast::UnOp::Neg, expr) => match &expr.kind {
|
||||
ast::ExprKind::Lit(_) => true,
|
||||
_ => false,
|
||||
},
|
||||
ast::ExprKind::Unary(ast::UnOp::Neg, expr) => {
|
||||
matches!(expr.kind, ast::ExprKind::Lit(_))
|
||||
}
|
||||
// We can only resolve single-segment paths at the moment, because multi-segment paths
|
||||
// require type-checking: see `visit_generic_arg` in `src/librustc_resolve/late.rs`.
|
||||
ast::ExprKind::Path(None, path)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue