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 28, 2019
1 parent 084beb8 commit d35f25c
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 @@ -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;
Expand Down

0 comments on commit d35f25c

Please sign in to comment.