Skip to content

Commit 4ab164f

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

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

clippy_lints/src/cognitive_complexity.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,23 @@ 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.
29+
///
30+
/// For more detailed information, see https://github.com/rust-lang/rust-clippy/issues/3793
2631
///
2732
/// ### Example
28-
/// You'll see it when you get the warning.
33+
/// -
2934
#[clippy::version = "1.35.0"]
3035
pub COGNITIVE_COMPLEXITY,
3136
nursery,

0 commit comments

Comments
 (0)