Open
Description
Summary
If a function argument is unused there is no way to know whether or not its signature is appropriate. It's better to not bother people with lints based entirely on the assumption of one usage when in reality it might have another usage if implemented.
Lint Name
clippy::ptr_arg
Reproducer
I tried this code:
fn bar(_x: &mut Vec<u32>) {
todo!()
}
I saw this happen:
warning: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
--> src/lib.rs:8:16
|
8 | fn bar(_x: &mut Vec<u32>) {
| ^^^^^^^^^^^^^ help: change this to: `&mut [u32]`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
= note: `#[warn(clippy::ptr_arg)]` on by default
I expected to see this happen:
No warning, there is no way to know if a slice would be sufficient once the function body is expanded to use the argument.
Version
rustc 1.84.0-nightly (a0d98ff0e 2024-10-31)
binary: rustc
commit-hash: a0d98ff0e5b6e1f2c63fd26f68484792621b235c
commit-date: 2024-10-31
host: aarch64-apple-darwin
release: 1.84.0-nightly
LLVM version: 19.1.1
Additional Labels
No response