Skip to content

Commit 842457f

Browse files
committed
actually fix it
1 parent 94c793e commit 842457f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

clippy_lints/src/mixed_read_write_in_expression.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use clippy_utils::diagnostics::{span_lint, span_lint_and_note};
22
use clippy_utils::{get_parent_expr, path_to_local, path_to_local_id};
33
use if_chain::if_chain;
4-
use rustc_hir::intravisit::{walk_block, walk_expr, Visitor};
4+
use rustc_hir::intravisit::{walk_expr, Visitor};
55
use rustc_hir::{BinOpKind, Block, Expr, ExprKind, Guard, HirId, Local, Node, Stmt, StmtKind};
66
use rustc_lint::{LateContext, LateLintPass};
77
use rustc_middle::ty;
@@ -171,7 +171,6 @@ impl<'a, 'tcx> Visitor<'tcx> for DivergenceVisitor<'a, 'tcx> {
171171
self.report_diverging_sub_expr(e);
172172
}
173173
},
174-
ExprKind::Block(block, ..) => walk_block(self, block),
175174
_ => {
176175
// do not lint expressions referencing objects of type `!`, as that required a
177176
// diverging expression
@@ -180,6 +179,9 @@ impl<'a, 'tcx> Visitor<'tcx> for DivergenceVisitor<'a, 'tcx> {
180179
}
181180
self.maybe_walk_expr(e);
182181
}
182+
fn visit_block(&mut self, _: &'tcx Block<'_>) {
183+
// don't continue over blocks, LateLintPass already does that
184+
}
183185
}
184186

185187
/// Walks up the AST from the given write expression (`vis.write_expr`) looking

0 commit comments

Comments
 (0)