Skip to content

Commit 15d1731

Browse files
committedMar 6, 2019
Auto merge of #3845 - euclio:unused-comments, r=phansch
move lint documentation into macro invocations This PR moves lint documentation inside `declare_clippy_lint!` macro invocations, to avoid triggering the `unused_doc_comments` lint once it's modified in rust-lang/rust#57882. This PR is necessary to unblock that work, since the large number of warnings generated in `clippy_lints` causes Travis to hit the log length limit. This PR also updates the documentation and website generation script. It would be nice to get a clippy update in the Rust repo once this is merged. cc @phansch
2 parents 400ee06 + a9de64a commit 15d1731

File tree

132 files changed

+5418
-5393
lines changed

Some content is hidden

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

132 files changed

+5418
-5393
lines changed
 

‎clippy_dev/src/lib.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ use walkdir::WalkDir;
1212
lazy_static! {
1313
static ref DEC_CLIPPY_LINT_RE: Regex = Regex::new(
1414
r#"(?x)
15-
declare_clippy_lint!\s*[\{(]\s*
16-
pub\s+(?P<name>[A-Z_][A-Z_0-9]*)\s*,\s*
15+
declare_clippy_lint!\s*[\{(]
16+
(?:\s+///.*)*
17+
\s+pub\s+(?P<name>[A-Z_][A-Z_0-9]*)\s*,\s*
1718
(?P<cat>[a-z_]+)\s*,\s*
1819
"(?P<desc>(?:[^"\\]+|\\(?s).(?-s))*)"\s*[})]
1920
"#
@@ -22,7 +23,8 @@ lazy_static! {
2223
static ref DEC_DEPRECATED_LINT_RE: Regex = Regex::new(
2324
r#"(?x)
2425
declare_deprecated_lint!\s*[{(]\s*
25-
pub\s+(?P<name>[A-Z_][A-Z_0-9]*)\s*,\s*
26+
(?:\s+///.*)*
27+
\s+pub\s+(?P<name>[A-Z_][A-Z_0-9]*)\s*,\s*
2628
"(?P<desc>(?:[^"\\]+|\\(?s).(?-s))*)"\s*[})]
2729
"#
2830
)

‎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`)"

0 commit comments

Comments
 (0)
Please sign in to comment.