about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authornathanwhit <nathan.whitaker01@gmail.com>2019-09-11 22:05:26 -0400
committerNathan <nathan.whitaker01@gmail.com>2019-09-27 21:06:10 -0400
commitd35f25cf96f2d0e6e8d0dc4ab48b9755f7703c9c (patch)
tree340b9181dedd50d4abff2af016d4baccd8b25733 /src/libsyntax
parent084beb83e0e87d673d5fabc844d28e8e8ae2ab4c (diff)
downloadrust-d35f25cf96f2d0e6e8d0dc4ab48b9755f7703c9c.tar.gz
rust-d35f25cf96f2d0e6e8d0dc4ab48b9755f7703c9c.zip
Filter out stmts made for the redundant_semicolon lint when pretty-printing
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/print/pprust.rs15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index a5792dab474..4b9c2d13f26 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -1657,9 +1657,18 @@ impl<'a> State<'a> {
                 }
             }
             ast::StmtKind::Semi(ref expr) => {
-                self.space_if_not_bol();
-                self.print_expr_outer_attr_style(expr, false);
-                self.s.word(";");
+                match expr.kind {
+                    // Filter out empty `Tup` exprs created for the `redundant_semicolon`
+                    // lint, as they shouldn't be visible and interact poorly
+                    // with proc macros.
+                    ast::ExprKind::Tup(ref exprs) if exprs.is_empty()
+                      && expr.attrs.is_empty() => (),
+                    _ => {
+                        self.space_if_not_bol();
+                        self.print_expr_outer_attr_style(expr, false);
+                        self.s.word(";");
+                    }
+                }
             }
             ast::StmtKind::Mac(ref mac) => {
                 let (ref mac, style, ref attrs) = **mac;