redundant_slicing false positive on bytes::buf::UninitSlice move #6968
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
Lint name:
redundant_slicing
While updating rust to 1.51, we hit a false positive on one of the new lints. Here's a minimal reproducer:
I expected to see this happen: No lint on the slicing at
&mut bytes[..]
, as it is required: instead of moving thebytes
variable to_bytes_msg
, thus shortening its lifetime, it will instead create a new borrow with its own lifetime inside of_bytes_msg
.Instead, this happened: Clippy complained about redundant slicing:
Note that this does not reproduce when using a normal
&mut [u8]
slice. Butbytes.chunk_mut()
returns its own slice-like objectUninitSlice
, on which this rule triggers.Meta
cargo clippy -V
: 0.1.52 (2021-03-24 07e0e2e)rustc -Vv
:The text was updated successfully, but these errors were encountered: