diff options
Diffstat (limited to 'src/tools/clippy/src/docs/transmute_int_to_bool.txt')
-rw-r--r-- | src/tools/clippy/src/docs/transmute_int_to_bool.txt | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/transmute_int_to_bool.txt b/src/tools/clippy/src/docs/transmute_int_to_bool.txt new file mode 100644 index 000000000..07c10f8d0 --- /dev/null +++ b/src/tools/clippy/src/docs/transmute_int_to_bool.txt @@ -0,0 +1,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; +```
\ No newline at end of file |