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

### Why is this bad?
This might result in an invalid in-memory representation of a `bool`.

### Example
```
let x = 1_u8;
unsafe {
    let _: bool = std::mem::transmute(x); // where x: u8
}

// should be:
let _: bool = x != 0;
```