Skip to content

Commit 80ebc4d

Browse files
committed
CI will fail
1 parent db644fe commit 80ebc4d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

clippy_lints/src/loops/utils.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ impl<'a, 'tcx> Visitor<'tcx> for IncrementVisitor<'a, 'tcx> {
7676
ExprKind::Assign(lhs, _, _) if lhs.hir_id == expr.hir_id => {
7777
*state = IncrementVisitorVarState::DontWarn;
7878
},
79-
ExprKind::AddrOf(BorrowKind::Ref, mutability, _) if mutability == Mutability::Mut => {
79+
ExprKind::AddrOf(BorrowKind::Ref, Mutability::Mut, _) => {
8080
*state = IncrementVisitorVarState::DontWarn;
8181
},
8282
_ => (),
@@ -226,7 +226,7 @@ impl<'a, 'tcx> Visitor<'tcx> for InitializeVisitor<'a, 'tcx> {
226226
InitializeVisitorState::DontWarn
227227
}
228228
},
229-
ExprKind::AddrOf(BorrowKind::Ref, mutability, _) if mutability == Mutability::Mut => {
229+
ExprKind::AddrOf(BorrowKind::Ref, Mutability::Mut, _) => {
230230
self.state = InitializeVisitorState::DontWarn;
231231
},
232232
_ => (),

clippy_lints/src/redundant_guard.rs

+6
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ impl<'tcx> LateLintPass<'tcx> for RedundantGuard {
5050
return;
5151
};
5252

53+
// TODO: This should not lint on locals that are used in the body, but that should be simple enough
54+
// to fix
55+
5356
for outer_arm in arms {
5457
let mut app = Applicability::MaybeIncorrect;
5558
let Some(guard) = outer_arm.guard else {
@@ -116,6 +119,9 @@ impl<'tcx> LateLintPass<'tcx> for RedundantGuard {
116119
// TODO: I'm not sure if this is always right. Can we always inline rhs? My intuition
117120
// says no, but I can't find a case where it can't be...
118121

122+
// ^ My intuition was correct, This will trigger on `input.span` and any function calls. It should
123+
// not do that
124+
119125
// `Some(x) if x == Some(2)`
120126
if let Guard::If(if_expr) = guard
121127
&& let ExprKind::Binary(bin_op, local, pat) = if_expr.kind

0 commit comments

Comments
 (0)