-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have
Description
Lint name: ptr_arg
I have a type alias somewhere:
type DocumentMap = Vec<Vec<Something>>;
and I have a function that takes a refence to one:
fn foo(map: &DocumentMap) { .. }
Clippy, run with -Dwarnings
, returns this suggestion:
error: writing `&Vec<_>` instead of `&[_]` involves one more reference and cannot be used with non-Vec-based slices
--> etc
|
193 | map: &DocumentMap,
| ^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
I think this suggestion is bad -- I want to keep this type alias. I have to pepper each function that receives such an arg with #[allow(clippy::ptr_arg)]
and a comment explaining why.
Meta
Rust version (rustc -Vv
):
rustc 1.55.0 (c8dfcfe04 2021-09-06)
binary: rustc
commit-hash: c8dfcfe046a7680554bf4eb612bad840e7631c4b
commit-date: 2021-09-06
host: x86_64-unknown-linux-gnu
release: 1.55.0
LLVM version: 12.0.1
clippy version:
clippy 0.1.55 (c8dfcfe 2021-09-06)
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have