From d9bb73331eff4bbcfb5610b96d2411ef751db20d Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Wed, 27 Dec 2023 19:32:49 -0800 Subject: [PATCH] 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. --- compiler/rustc_ast_pretty/src/pprust/state.rs | 5 +---- 1 file changed, 1 insertion(+), 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(";"); } }