RS.CLIPPY.TRANSMUTES_EXPRESSIBLE_AS_PTR_CASTS

Transmutes that could be a pointer cast

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: transmutes_expressible_as_ptr_casts. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Checks for transmutes that could be a pointer cast.

Why is this bad?

Readability. The code tricks people into thinking that something complex is going on.

Example

unsafe { std::mem::transmute::<*const [i32], *const [u16]>(p) };

Use instead:

p as *const [u16];