Skip to content

Commit

Permalink
Delete MacCall case from pretty-printing semicolon after StmtKind::Expr
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dtolnay committed May 11, 2024
1 parent 7f2ffbd commit d9bb733
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions compiler/rustc_ast_pretty/src/pprust/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1253,10 +1253,7 @@ impl<'a> State<'a> {
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(";");
}
}
Expand Down

0 comments on commit d9bb733

Please sign in to comment.