about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@gmail.com>2023-12-27 19:32:49 -0800
committerDavid Tolnay <dtolnay@gmail.com>2024-05-11 15:49:02 -0700
commitd9bb73331eff4bbcfb5610b96d2411ef751db20d (patch)
treeaecbbafcf7a58030c98962194f1e2d4cb1421723
parent7f2ffbdbc6c0d5e1c7fabe0bef56ec49d10bfeab (diff)
downloadrust-d9bb73331eff4bbcfb5610b96d2411ef751db20d.tar.gz
rust-d9bb73331eff4bbcfb5610b96d2411ef751db20d.zip
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.
-rw-r--r--compiler/rustc_ast_pretty/src/pprust/state.rs5
1 files changed, 1 insertions, 4 deletions
diff --git a/compiler/rustc_ast_pretty/src/pprust/state.rs b/compiler/rustc_ast_pretty/src/pprust/state.rs
index fe17ff41bc3..2c176828c84 100644
--- a/compiler/rustc_ast_pretty/src/pprust/state.rs
+++ b/compiler/rustc_ast_pretty/src/pprust/state.rs
@@ -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(";");
                 }
             }