Skip to content

Commit e47f493

Browse files
committed
Correct the CC lint's documentation
1 parent beaf155 commit e47f493

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

clippy_lints/src/cognitive_complexity.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,25 @@ use rustc_span::def_id::LocalDefId;
1414

1515
declare_clippy_lint! {
1616
/// ### What it does
17-
/// Checks for methods with high cognitive complexity.
17+
/// We used to think it measured how hard a method is to understand.
1818
///
1919
/// ### Why is this bad?
20-
/// Methods of high cognitive complexity tend to be hard to
21-
/// both read and maintain. Also LLVM will tend to optimize small methods better.
20+
/// Ideally, we would like to be able to measure how hard a function is
21+
/// to understand given its context (what we call its Cognitive Complexity).
22+
/// But that's not what this lint does. See "Known problems"
2223
///
2324
/// ### Known problems
24-
/// Sometimes it's hard to find a way to reduce the
25-
/// complexity.
25+
/// The true Cognitive Complexity of a method is not something we can
26+
/// calculate using modern technology. This lint has been left in the
27+
/// `nursery` so as to not mislead users into using this lint as a
28+
/// measurement tool.
2629
///
27-
/// ### Example
28-
/// You'll see it when you get the warning.
30+
/// For more detailed information, see [rust-clippy#3793](https://github.com/rust-lang/rust-clippy/issues/3793)
31+
///
32+
/// ### Lints to consider instead of this
33+
///
34+
/// * [`excessive_nesting`](https://rust-lang.github.io/rust-clippy/master/index.html#excessive_nesting)
35+
/// * [`too_many_lines`](https://rust-lang.github.io/rust-clippy/master/index.html#too_many_lines)
2936
#[clippy::version = "1.35.0"]
3037
pub COGNITIVE_COMPLEXITY,
3138
nursery,

0 commit comments

Comments
 (0)