Delete MacCall case from pretty-printing semicolon after StmtKind::Expr

I didn't figure out how to reach this condition with `expr` containing
`ExprKind::MacCall`. All the approaches I tried ended up with the macro
call ending up in the `StmtKind::MacCall` case below instead.

In any case, from visual inspection this is a bugfix. If we do end up
with a `StmtKind::Expr` containing `ExprKind::MacCall` with brace
delimiter, it would not need ";" printed after it.
This commit is contained in:
David Tolnay 2023-12-27 19:32:49 -08:00
parent 7f2ffbdbc6
commit d9bb73331e
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -1253,10 +1253,7 @@ fn print_stmt(&mut self, st: &ast::Stmt) {
ast::StmtKind::Expr(expr) => {
self.space_if_not_bol();
self.print_expr_outer_attr_style(expr, false, FixupContext::new_stmt());
if match expr.kind {
ast::ExprKind::MacCall(_) => true,
_ => classify::expr_requires_semi_to_be_stmt(expr),
} {
if classify::expr_requires_semi_to_be_stmt(expr) {
self.word(";");
}
}