-
Notifications
You must be signed in to change notification settings - Fork 13.3k
add a lint for useless transmutes #11400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I am not sure about this. In |
I think there was a similar problem with #11135 (a lint for unnecessary type casts). This lint defaults to |
Would it be feasible to write up a list of platform-specific types? Ideally, users won't be creating new ones, so we can exclude them from the warning. |
I think this could work. Some lints already use static lists, the |
That sample code should now be: fn main() {
unsafe { std::mem::transmute::<int, int> ( 52 ) };
} |
/cc @Manishearth , does clippy have one of these? |
Should have a warning. In general,
transmute::<T, T>
should be warned against.The text was updated successfully, but these errors were encountered: