diff --git a/tests/ui/cognitive_complexity.rs b/tests/ui/cognitive_complexity.rs index 4f6dd35e8cbb..8080c6775e0b 100644 --- a/tests/ui/cognitive_complexity.rs +++ b/tests/ui/cognitive_complexity.rs @@ -454,15 +454,17 @@ mod issue9300 { } } -#[clippy::cognitive_complexity = "2"] +#[clippy::cognitive_complexity = "1"] mod issue14422 { fn foo() { + //~^ cognitive_complexity for _ in 0..10 { println!("hello there"); } } fn bar() { + //~^ cognitive_complexity for _ in 0..10 { println!("hello there"); } diff --git a/tests/ui/cognitive_complexity.stderr b/tests/ui/cognitive_complexity.stderr index 2be56ff88b34..67ef4e5655bd 100644 --- a/tests/ui/cognitive_complexity.stderr +++ b/tests/ui/cognitive_complexity.stderr @@ -160,5 +160,21 @@ LL | pub async fn async_method() { | = help: you could split it up into multiple smaller functions -error: aborting due to 20 previous errors +error: the function has a cognitive complexity of (2/1) + --> tests/ui/cognitive_complexity.rs:459:8 + | +LL | fn foo() { + | ^^^ + | + = help: you could split it up into multiple smaller functions + +error: the function has a cognitive complexity of (2/1) + --> tests/ui/cognitive_complexity.rs:466:8 + | +LL | fn bar() { + | ^^^ + | + = help: you could split it up into multiple smaller functions + +error: aborting due to 22 previous errors