False positive for `clippy::needless_borrows_for_generic_args`?
⚓ Rust 📅 2026-02-08 👤 surdeus 👁️ 7I have an example on the playground: Rust Playground
When I run Clippy on it, I get:
warning: the borrowed expression implements the required traits
with this suggestion:
10 | process(&mut data);
| ^^^^^^^^^ help: change this to: `data`
However, data is a built-in array and removing &mut would copy it instead of making the intended mutation to the original data. I would say that's not a good suggestion.
So is this a false positive?
Or am I doing something wrong?
If it is a false positive, I can create an issue, but I wanted to check here first if I'm understanding it correctly.
And a follow-up question: Is there a way to change my function signature to somehow disallow unintentionally calling it with a copy of an array (but at the same time still allow the chunks_mut() use case I mentioned in the playground example)?
1 post - 1 participant
🏷️ Rust_feed