-
Couldn't load subscription status.
- Fork 1.8k
Open
Labels
C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesCategory: Enhancement of lints, like adding more cases or adding help messagesL-styleLint: Belongs in the style lint groupLint: Belongs in the style lint groupT-middleType: Probably requires verifiying typesType: Probably requires verifiying typesgood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy
Description
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)
struct Foo(*const i32);
fn foo(foo: &Foo) -> &i32 {
unsafe { transmute(foo) }
}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).
Metadata
Metadata
Assignees
Labels
C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesCategory: Enhancement of lints, like adding more cases or adding help messagesL-styleLint: Belongs in the style lint groupLint: Belongs in the style lint groupT-middleType: Probably requires verifiying typesType: Probably requires verifiying typesgood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy