Skip to content

Commit 382b3f0

Browse files
committed
Fix counting the number of unchangeable arguments in ptr_arg
1 parent 7f8760a commit 382b3f0

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

clippy_lints/src/ptr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ fn check_ptr_arg_usage<'tcx>(cx: &LateContext<'tcx>, body: &'tcx Body<'_>, args:
547547

548548
// Helper function to handle early returns.
549549
let mut set_skip_flag = || {
550-
if result.skip {
550+
if !result.skip {
551551
self.skip_count += 1;
552552
}
553553
result.skip = true;

tests/ui/ptr_arg.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,11 @@ pub trait Trait {
186186
fn f(v: &mut Vec<i32>);
187187
fn f2(v: &mut Vec<i32>) {}
188188
}
189+
190+
// Issue #8463
191+
fn two_vecs(a: &mut Vec<u32>, b: &mut Vec<u32>) {
192+
a.push(0);
193+
a.push(0);
194+
a.push(0);
195+
b.push(1);
196+
}

0 commit comments

Comments
 (0)