Remove redundant matching

This commit is contained in:
Cameron Steffen 2021-10-13 14:45:35 -05:00
parent 313e71a253
commit c75a734a43

View file

@ -1087,26 +1087,20 @@ impl<'a, 'b> InvocationCollector<'a, 'b> {
let MacCallStmt { mac, style, attrs, .. } = mac.into_inner(); let MacCallStmt { mac, style, attrs, .. } = mac.into_inner();
Ok((style == MacStmtStyle::Semicolon, mac, attrs.into())) Ok((style == MacStmtStyle::Semicolon, mac, attrs.into()))
} }
StmtKind::Item(ref item) if matches!(item.kind, ItemKind::MacCall(..)) => { StmtKind::Item(item) if matches!(item.kind, ItemKind::MacCall(..)) => {
match stmt.kind { match item.into_inner() {
StmtKind::Item(item) => match item.into_inner() {
ast::Item { kind: ItemKind::MacCall(mac), attrs, .. } => { ast::Item { kind: ItemKind::MacCall(mac), attrs, .. } => {
Ok((mac.args.need_semicolon(), mac, attrs)) Ok((mac.args.need_semicolon(), mac, attrs))
} }
_ => unreachable!(), _ => unreachable!(),
},
_ => unreachable!(),
} }
} }
StmtKind::Semi(ref expr) if matches!(expr.kind, ast::ExprKind::MacCall(..)) => { StmtKind::Semi(expr) if matches!(expr.kind, ast::ExprKind::MacCall(..)) => {
match stmt.kind { match expr.into_inner() {
StmtKind::Semi(expr) => match expr.into_inner() {
ast::Expr { kind: ast::ExprKind::MacCall(mac), attrs, .. } => { ast::Expr { kind: ast::ExprKind::MacCall(mac), attrs, .. } => {
Ok((mac.args.need_semicolon(), mac, attrs.into())) Ok((mac.args.need_semicolon(), mac, attrs.into()))
} }
_ => unreachable!(), _ => unreachable!(),
},
_ => unreachable!(),
} }
} }
StmtKind::Local(..) | StmtKind::Empty | StmtKind::Item(..) | StmtKind::Semi(..) => { StmtKind::Local(..) | StmtKind::Empty | StmtKind::Item(..) | StmtKind::Semi(..) => {