Static UNNECESSARY_TRANSMUTES

Source
pub static UNNECESSARY_TRANSMUTES: &'static Lint
Expand description

The unnecessary_transmutes lint detects transmutations that have safer alternatives.

§Example

fn bytes_at_home(x: [u8; 4]) -> u32 {
  unsafe { std::mem::transmute(x) }
}

{{produces}}

§Explanation

Using an explicit method is preferable over calls to transmute as they more clearly communicate the intent, are easier to review, and are less likely to accidentally result in unsoundness.