]>
Commit | Line | Data |
---|---|---|
f2b60f7d FG |
1 | ### What it does |
2 | Checks for transmutes from a float to an integer. | |
3 | ||
4 | ### Why is this bad? | |
5 | Transmutes are dangerous and error-prone, whereas `to_bits` is intuitive | |
6 | and safe. | |
7 | ||
8 | ### Example | |
9 | ``` | |
10 | unsafe { | |
11 | let _: u32 = std::mem::transmute(1f32); | |
12 | } | |
13 | ||
14 | // should be: | |
15 | let _: u32 = 1f32.to_bits(); | |
16 | ``` |