]> git.lizzy.rs Git - rust.git/blob - src/docs/transmutes_expressible_as_ptr_casts.txt
Auto merge of #9421 - xphoniex:fix-#9420, r=giraffate
[rust.git] / src / docs / transmutes_expressible_as_ptr_casts.txt
1 ### What it does
2 Checks for transmutes that could be a pointer cast.
3
4 ### Why is this bad?
5 Readability. The code tricks people into thinking that
6 something complex is going on.
7
8 ### Example
9
10 ```
11 unsafe { std::mem::transmute::<*const [i32], *const [u16]>(p) };
12 ```
13 Use instead:
14 ```
15 p as *const [u16];
16 ```