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