added wiki comments + wiki-generating python script

This commit is contained in:
llogiq 2015-12-11 01:22:27 +01:00
parent 2fbe762a99
commit 5bbc1427fd
28 changed files with 668 additions and 0 deletions

View file

@ -6,6 +6,13 @@ use syntax::ast::Lit_::*;
use syntax::ast::Lit;
use syntax::ast::FloatTy::*;
/// **What it does:** This lint 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. This lint is `Warn` by default.
///
/// **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).
///
/// **Known problems:** If you happen to have a value that is within 1/8192 of a known constant, but is not *and should not* be the same, this lint will report your value anyway. We have not yet noticed any false positives in code we tested clippy with (this includes servo), but YMMV.
///
/// **Example:** `let x = 3.14;`
declare_lint! {
pub APPROX_CONSTANT,
Warn,