Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d854e03

Browse files
committedMar 5, 2019
move lint documentation into macro invocations
1 parent a8f61e7 commit d854e03

File tree

131 files changed

+5402
-5389
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+5402
-5389
lines changed
 

‎clippy_lints/src/approx_const.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,28 @@ use std::f64::consts as f64;
66
use syntax::ast::{FloatTy, Lit, LitKind};
77
use syntax::symbol;
88

9-
/// **What it does:** Checks for floating point literals that approximate
10-
/// constants which are defined in
11-
/// [`std::f32::consts`](https://doc.rust-lang.org/stable/std/f32/consts/#constants)
12-
/// or
13-
/// [`std::f64::consts`](https://doc.rust-lang.org/stable/std/f64/consts/#constants),
14-
/// respectively, suggesting to use the predefined constant.
15-
///
16-
/// **Why is this bad?** Usually, the definition in the standard library is more
17-
/// precise than what people come up with. If you find that your definition is
18-
/// actually more precise, please [file a Rust
19-
/// issue](https://github.com/rust-lang/rust/issues).
20-
///
21-
/// **Known problems:** If you happen to have a value that is within 1/8192 of a
22-
/// known constant, but is not *and should not* be the same, this lint will
23-
/// report your value anyway. We have not yet noticed any false positives in
24-
/// code we tested clippy with (this includes servo), but YMMV.
25-
///
26-
/// **Example:**
27-
/// ```rust
28-
/// let x = 3.14;
29-
/// ```
309
declare_clippy_lint! {
10+
/// **What it does:** Checks for floating point literals that approximate
11+
/// constants which are defined in
12+
/// [`std::f32::consts`](https://doc.rust-lang.org/stable/std/f32/consts/#constants)
13+
/// or
14+
/// [`std::f64::consts`](https://doc.rust-lang.org/stable/std/f64/consts/#constants),
15+
/// respectively, suggesting to use the predefined constant.
16+
///
17+
/// **Why is this bad?** Usually, the definition in the standard library is more
18+
/// precise than what people come up with. If you find that your definition is
19+
/// actually more precise, please [file a Rust
20+
/// issue](https://github.com/rust-lang/rust/issues).
21+
///
22+
/// **Known problems:** If you happen to have a value that is within 1/8192 of a
23+
/// known constant, but is not *and should not* be the same, this lint will
24+
/// report your value anyway. We have not yet noticed any false positives in
25+
/// code we tested clippy with (this includes servo), but YMMV.
26+
///
27+
/// **Example:**
28+
/// ```rust
29+
/// let x = 3.14;
30+
/// ```
3131
pub APPROX_CONSTANT,
3232
correctness,
3333
"the approximate of a known float constant (in `std::fXX::consts`)"

‎clippy_lints/src/arithmetic.rs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,36 @@ use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
55
use rustc::{declare_tool_lint, lint_array};
66
use syntax::source_map::Span;
77

8-
/// **What it does:** Checks for plain integer arithmetic.
9-
///
10-
/// **Why is this bad?** This is only checked against overflow in debug builds.
11-
/// In some applications one wants explicitly checked, wrapping or saturating
12-
/// arithmetic.
13-
///
14-
/// **Known problems:** None.
15-
///
16-
/// **Example:**
17-
/// ```rust
18-
/// a + 1
19-
/// ```
208
declare_clippy_lint! {
9+
/// **What it does:** Checks for plain integer arithmetic.
10+
///
11+
/// **Why is this bad?** This is only checked against overflow in debug builds.
12+
/// In some applications one wants explicitly checked, wrapping or saturating
13+
/// arithmetic.
14+
///
15+
/// **Known problems:** None.
16+
///
17+
/// **Example:**
18+
/// ```rust
19+
/// a + 1
20+
/// ```
2121
pub INTEGER_ARITHMETIC,
2222
restriction,
2323
"any integer arithmetic statement"
2424
}
2525

26-
/// **What it does:** Checks for float arithmetic.
27-
///
28-
/// **Why is this bad?** For some embedded systems or kernel development, it
29-
/// can be useful to rule out floating-point numbers.
30-
///
31-
/// **Known problems:** None.
32-
///
33-
/// **Example:**
34-
/// ```rust
35-
/// a + 1.0
36-
/// ```
3726
declare_clippy_lint! {
27+
/// **What it does:** Checks for float arithmetic.
28+
///
29+
/// **Why is this bad?** For some embedded systems or kernel development, it
30+
/// can be useful to rule out floating-point numbers.
31+
///
32+
/// **Known problems:** None.
33+
///
34+
/// **Example:**
35+
/// ```rust
36+
/// a + 1.0
37+
/// ```
3838
pub FLOAT_ARITHMETIC,
3939
restriction,
4040
"any floating-point arithmetic statement"

0 commit comments

Comments
 (0)
Please sign in to comment.