Skip to content

Commit

Permalink
Filter out stmts made for the redundant_semicolon lint when pretty-pr…
Browse files Browse the repository at this point in the history
…inting
  • Loading branch information
nathanwhit committed Sep 12, 2019
1 parent fe6d05a commit e608549
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/libsyntax/print/pprust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1651,9 +1651,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.node {
// 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;
Expand Down

0 comments on commit e608549

Please sign in to comment.