]> git.lizzy.rs Git - rust.git/blob - src/docs/transmute_int_to_bool.txt
Add iter_kv_map lint
[rust.git] / src / docs / transmute_int_to_bool.txt
1 ### What it does
2 Checks for transmutes from an integer to a `bool`.
3
4 ### Why is this bad?
5 This might result in an invalid in-memory representation of a `bool`.
6
7 ### Example
8 ```
9 let x = 1_u8;
10 unsafe {
11     let _: bool = std::mem::transmute(x); // where x: u8
12 }
13
14 // should be:
15 let _: bool = x != 0;
16 ```