size_of_in_element_count false positive with u8 element type #6590
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: size_of_in_element_count
I tried this code:
I expected to see this happen: Clippy should not give a
size_of_in_element_count
error.Instead, this happened for
rustup run nightly cargo clippy
:In contrast, clippy (correctly) does not give an error for this code:
In other words, I've seen the false positive only for the
u8
case.The false positive also occurs for the following similar code, but again, only for the
u8
case:You might wonder why anyone would write a functions like
u8_as_bytes
oru8_slice_as_bytes
. This came up for me because they're in a macro that implements a trait, and the macro is used for all the numeric primitives, includingu8
. (Here's the CI failure for my crate due to the clippy lint.)Meta
rustup run nightly cargo clippy -V
: clippy 0.1.51 (a62a760 2021-01-13)rustup run nightly rustc -Vv
:The text was updated successfully, but these errors were encountered: