summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/transmute_float_to_int.txt
blob: 1877e5a465a4e647109046845814004e2b9de50b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
### What it does
Checks for transmutes from a float to an integer.

### Why is this bad?
Transmutes are dangerous and error-prone, whereas `to_bits` is intuitive
and safe.

### Example
```
unsafe {
    let _: u32 = std::mem::transmute(1f32);
}

// should be:
let _: u32 = 1f32.to_bits();
```