]> git.lizzy.rs Git - rust.git/blob - src/docs/transmute_int_to_float.txt
Add iter_kv_map lint
[rust.git] / src / docs / transmute_int_to_float.txt
1 ### What it does
2 Checks for transmutes from an integer to a float.
3
4 ### Why is this bad?
5 Transmutes are dangerous and error-prone, whereas `from_bits` is intuitive
6 and safe.
7
8 ### Example
9 ```
10 unsafe {
11     let _: f32 = std::mem::transmute(1_u32); // where x: u32
12 }
13
14 // should be:
15 let _: f32 = f32::from_bits(1_u32);
16 ```