You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just ran clippy on an old project where I have some code like:
use std::mem::{transmute,MaybeUninit};structFoo<T>{array:Box<[T]>,}impl<T>Foo<MaybeUninit<T>>{unsafefnassume_init(self) -> Foo<T>{Foo{array:unsafe{transmute::<_,Box<[T]>>(self.array)}}}}
The "Why is this bad?" section states:
If not set, some unexpected output type could be retrieved instead of the expected one, potentially leading to invalid code.
This is particularly dangerous in case a seemingly innocent/unrelated change can cause type inference to start inferring a different type. E.g. the transmute is the tail expression of an if branch, and a different branches type changes, causing the transmute to silently have a different type, instead of a proper error.
This explanation doesn't cover the case where the output type is specified but not the input type.
Either the description should be updated to explain why transmute::<_, T> is also bad or the lint should only apply when the output type is missing.
Description
I just ran clippy on an old project where I have some code like:
The "Why is this bad?" section states:
This explanation doesn't cover the case where the output type is specified but not the input type.
Either the description should be updated to explain why
transmute::<_, T>
is also bad or the lint should only apply when the output type is missing.Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: