unnecessary_cast should catch unnecessary pointer cast #12738
Labels
C-bug
Category: Clippy is not doing the correct thing
I-false-negative
Issue: The lint should have been triggered on code, but wasn't
Summary
unnecessary_cast should catch unnecessary pointer casts like
&u32
to*const u32
when this would already be done implicitlyedge case to consider:
it is not always converted implicitly, like when changing the type like this:
a as *const u32 as *const i32
, witha: &u32
Lint Name
unnecessary_cast
Reproducer
I tried this code:
I expected to see this happen:
get a warning from the lint for both casts
Instead, this happened:
there only is a warning for the u32 -> u32 cast
Version
The text was updated successfully, but these errors were encountered: