False positive in ptr_arg
when function pushes to &mut Vec
#8463
Labels
C-bug
Category: Clippy is not doing the correct thing
I-false-positive
Issue: The lint was triggered on code it shouldn't have
Summary
When a function has the signature
&mut Vec<T>
and pushes to it, it cannot be converted to&mut [T]
. However, in some cases, clippy recommends doing so.Lint Name
ptr_arg
Reproducer
It is not easy to trigger this, so I will use the example I found it:
I saw this happen:
However, If any of them are changed as suggested, the code does not compile.
The image below quickly illustrates the issue:
buffer.push
is not implemented for&mut [ipc::Buffer]
, but clippy recommends replacing it:Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: