Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit aa2f48b

Browse files
committed
Change Test for Issue 14422 (Cognitive Complexity lowered through multiple returns) to test it does'nt regress to false negative
1 parent d19c651 commit aa2f48b

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

tests/ui/cognitive_complexity.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,15 +454,17 @@ mod issue9300 {
454454
}
455455
}
456456

457-
#[clippy::cognitive_complexity = "2"]
457+
#[clippy::cognitive_complexity = "1"]
458458
mod issue14422 {
459459
fn foo() {
460+
//~^ cognitive_complexity
460461
for _ in 0..10 {
461462
println!("hello there");
462463
}
463464
}
464465

465466
fn bar() {
467+
//~^ cognitive_complexity
466468
for _ in 0..10 {
467469
println!("hello there");
468470
}

tests/ui/cognitive_complexity.stderr

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,5 +160,21 @@ LL | pub async fn async_method() {
160160
|
161161
= help: you could split it up into multiple smaller functions
162162

163-
error: aborting due to 20 previous errors
163+
error: the function has a cognitive complexity of (2/1)
164+
--> tests/ui/cognitive_complexity.rs:459:8
165+
|
166+
LL | fn foo() {
167+
| ^^^
168+
|
169+
= help: you could split it up into multiple smaller functions
170+
171+
error: the function has a cognitive complexity of (2/1)
172+
--> tests/ui/cognitive_complexity.rs:466:8
173+
|
174+
LL | fn bar() {
175+
| ^^^
176+
|
177+
= help: you could split it up into multiple smaller functions
178+
179+
error: aborting due to 22 previous errors
164180

0 commit comments

Comments
 (0)