Skip to content

Commit

Permalink
Visit BinOp span in MutVisitor::visit_expr
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Dec 3, 2024
1 parent 42b4b9c commit a2eca35
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
3 changes: 2 additions & 1 deletion compiler/rustc_ast/src/mut_visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1628,9 +1628,10 @@ pub fn walk_expr<T: MutVisitor>(vis: &mut T, Expr { kind, id, span, attrs, token
visit_thin_exprs(vis, call_args);
vis.visit_span(span);
}
ExprKind::Binary(_binop, lhs, rhs) => {
ExprKind::Binary(binop, lhs, rhs) => {
vis.visit_expr(lhs);
vis.visit_expr(rhs);
vis.visit_span(&mut binop.span);
}
ExprKind::Unary(_unop, ohs) => vis.visit_expr(ohs),
ExprKind::Cast(expr, ty) => {
Expand Down
7 changes: 0 additions & 7 deletions tests/ui-fulldeps/pprust-parenthesis-insertion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,6 @@ impl MutVisitor for Normalize {
*span = DUMMY_SP;
}

fn visit_expr(&mut self, expr: &mut P<Expr>) {
if let ExprKind::Binary(binop, _left, _right) = &mut expr.kind {
self.visit_span(&mut binop.span);
}
mut_visit::walk_expr(self, expr);
}

fn flat_map_stmt(&mut self, mut stmt: Stmt) -> SmallVec<[Stmt; 1]> {
self.visit_span(&mut stmt.span);
mut_visit::walk_flat_map_stmt(self, stmt)
Expand Down

0 comments on commit a2eca35

Please sign in to comment.