diff options
Diffstat (limited to 'src/tools/clippy/src/docs/cast_nan_to_int.txt')
-rw-r--r-- | src/tools/clippy/src/docs/cast_nan_to_int.txt | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/cast_nan_to_int.txt b/src/tools/clippy/src/docs/cast_nan_to_int.txt new file mode 100644 index 000000000..122f5da0c --- /dev/null +++ b/src/tools/clippy/src/docs/cast_nan_to_int.txt @@ -0,0 +1,15 @@ +### What it does +Checks for a known NaN float being cast to an integer + +### Why is this bad? +NaNs are cast into zero, so one could simply use this and make the +code more readable. The lint could also hint at a programmer error. + +### Example +``` +let _: (0.0_f32 / 0.0) as u64; +``` +Use instead: +``` +let _: = 0_u64; +```
\ No newline at end of file |