diff options
Diffstat (limited to 'src/tools/clippy/src/docs/excessive_precision.txt')
-rw-r--r-- | src/tools/clippy/src/docs/excessive_precision.txt | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/excessive_precision.txt b/src/tools/clippy/src/docs/excessive_precision.txt new file mode 100644 index 000000000..517879c47 --- /dev/null +++ b/src/tools/clippy/src/docs/excessive_precision.txt @@ -0,0 +1,18 @@ +### What it does +Checks for float literals with a precision greater +than that supported by the underlying type. + +### Why is this bad? +Rust will truncate the literal silently. + +### Example +``` +let v: f32 = 0.123_456_789_9; +println!("{}", v); // 0.123_456_789 +``` + +Use instead: +``` +let v: f64 = 0.123_456_789_9; +println!("{}", v); // 0.123_456_789_9 +```
\ No newline at end of file |