diff options
Diffstat (limited to 'src/docs/approx_constant.txt')
| -rw-r--r-- | src/docs/approx_constant.txt | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/src/docs/approx_constant.txt b/src/docs/approx_constant.txt deleted file mode 100644 index 393fa4b5ef7..00000000000 --- a/src/docs/approx_constant.txt +++ /dev/null @@ -1,24 +0,0 @@ -### What it does -Checks for floating point literals that approximate -constants which are defined in -[`std::f32::consts`](https://doc.rust-lang.org/stable/std/f32/consts/#constants) -or -[`std::f64::consts`](https://doc.rust-lang.org/stable/std/f64/consts/#constants), -respectively, suggesting to use the predefined constant. - -### Why is this bad? -Usually, the definition in the standard library is more -precise than what people come up with. If you find that your definition is -actually more precise, please [file a Rust -issue](https://github.com/rust-lang/rust/issues). - -### Example -``` -let x = 3.14; -let y = 1_f64 / x; -``` -Use instead: -``` -let x = std::f32::consts::PI; -let y = std::f64::consts::FRAC_1_PI; -``` \ No newline at end of file |
