diff options
| author | Jason Newcomb <jsnewcomb@pm.me> | 2022-02-23 01:04:49 -0500 |
|---|---|---|
| committer | Jason Newcomb <jsnewcomb@pm.me> | 2022-02-23 01:04:49 -0500 |
| commit | 382b3f0601ea510e4cb4d0dd6c73310eb79708de (patch) | |
| tree | fb05b927db911812a52c950161cfdd2c5c6483d9 | |
| parent | 7f8760a44ce9b1424f6f1519ed452d6b323bc275 (diff) | |
| download | rust-382b3f0601ea510e4cb4d0dd6c73310eb79708de.tar.gz rust-382b3f0601ea510e4cb4d0dd6c73310eb79708de.zip | |
Fix counting the number of unchangeable arguments in `ptr_arg`
| -rw-r--r-- | clippy_lints/src/ptr.rs | 2 | ||||
| -rw-r--r-- | tests/ui/ptr_arg.rs | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/clippy_lints/src/ptr.rs b/clippy_lints/src/ptr.rs index e0ce1b7db00..2c328195f24 100644 --- a/clippy_lints/src/ptr.rs +++ b/clippy_lints/src/ptr.rs @@ -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; diff --git a/tests/ui/ptr_arg.rs b/tests/ui/ptr_arg.rs index 00b99da2631..97990fedd51 100644 --- a/tests/ui/ptr_arg.rs +++ b/tests/ui/ptr_arg.rs @@ -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); +} |
