Skip to content

Commit

Permalink
Auto merge of rust-lang#8464 - Jarcho:ptr_arg_8463, r=camsteffen
Browse files Browse the repository at this point in the history
Fix `ptr_arg`

fixes: rust-lang#8463

changelog: Fix `ptr_arg` when multiple arguments are being checked in one function
  • Loading branch information
bors committed Feb 26, 2022
2 parents 2c8d5a2 + 382b3f0 commit e329249
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion clippy_lints/src/ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ fn check_ptr_arg_usage<'tcx>(cx: &LateContext<'tcx>, body: &'tcx Body<'_>, args:

// Helper function to handle early returns.
let mut set_skip_flag = || {
if result.skip {
if !result.skip {
self.skip_count += 1;
}
result.skip = true;
Expand Down
8 changes: 8 additions & 0 deletions tests/ui/ptr_arg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,11 @@ pub trait Trait {
fn f(v: &mut Vec<i32>);
fn f2(v: &mut Vec<i32>) {}
}

// Issue #8463
fn two_vecs(a: &mut Vec<u32>, b: &mut Vec<u32>) {
a.push(0);
a.push(0);
a.push(0);
b.push(1);
}

0 comments on commit e329249

Please sign in to comment.