extend transmute_ptr_to_ref to detect transmuting newtypes around ptrs #1966
Labels
C-enhancement
Category: Enhancement of lints, like adding more cases or adding help messages
good-first-issue
These issues are a good way to get started with Clippy
L-style
Lint: Belongs in the style lint group
T-middle
Type: Probably requires verifiying types
We just had something like the following code in IRC. It would be nice if clippy suggested to replace the transmute with
&*(self.0 as *const i32)
This is an extension of the existing lint that complains about
transmute<*const T, &T>(raw_ptr)
. We just need to check whether the transmuted-from type is a struct which has only a single raw pointer field (or all other fields are ZST).The text was updated successfully, but these errors were encountered: