Skip to content

Commit db3b85c

Browse files
nathanwhitMark-Simulacrum
authored andcommitted
Filter out stmts made for the redundant_semicolon lint when pretty-printing
1 parent e31afd3 commit db3b85c

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/libsyntax/print/pprust.rs

+12-3
Original file line numberDiff line numberDiff line change
@@ -1657,9 +1657,18 @@ impl<'a> State<'a> {
16571657
}
16581658
}
16591659
ast::StmtKind::Semi(ref expr) => {
1660-
self.space_if_not_bol();
1661-
self.print_expr_outer_attr_style(expr, false);
1662-
self.s.word(";");
1660+
match expr.node {
1661+
// Filter out empty `Tup` exprs created for the `redundant_semicolon`
1662+
// lint, as they shouldn't be visible and interact poorly
1663+
// with proc macros.
1664+
ast::ExprKind::Tup(ref exprs) if exprs.is_empty()
1665+
&& expr.attrs.is_empty() => (),
1666+
_ => {
1667+
self.space_if_not_bol();
1668+
self.print_expr_outer_attr_style(expr, false);
1669+
self.s.word(";");
1670+
}
1671+
}
16631672
}
16641673
ast::StmtKind::Mac(ref mac) => {
16651674
let (ref mac, style, ref attrs) = **mac;

0 commit comments

Comments
 (0)