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)?
I think there could be room for a lint that catches passing mutable borrows of temporaries to functions (ie. semantics similar to C++). It feels like a footgun and is rarely what's intended.