Skip to content

Commit e608549

Browse files
committed
Filter out stmts made for the redundant_semicolon lint when pretty-printing
1 parent fe6d05a commit e608549

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
@@ -1651,9 +1651,18 @@ impl<'a> State<'a> {
16511651
}
16521652
}
16531653
ast::StmtKind::Semi(ref expr) => {
1654-
self.space_if_not_bol();
1655-
self.print_expr_outer_attr_style(expr, false);
1656-
self.s.word(";");
1654+
match expr.node {
1655+
// Filter out empty `Tup` exprs created for the `redundant_semicolon`
1656+
// lint, as they shouldn't be visible and interact poorly
1657+
// with proc macros.
1658+
ast::ExprKind::Tup(ref exprs) if exprs.is_empty()
1659+
&& expr.attrs.is_empty() => (),
1660+
_ => {
1661+
self.space_if_not_bol();
1662+
self.print_expr_outer_attr_style(expr, false);
1663+
self.s.word(";");
1664+
}
1665+
}
16571666
}
16581667
ast::StmtKind::Mac(ref mac) => {
16591668
let (ref mac, style, ref attrs) = **mac;

0 commit comments

Comments
 (0)