Skip to content

Commit dbc0755

Browse files
authored
Change Test for Issue 14422 (Cognitive Complexity lowered through mul… (#14603)
changelog: [cognitive_complexity]: Changed Test for this issue from making sure its not a false positive to making sure its not a false negative which was the original issue at hand. The test as it was would also not fail without the change introduced. This test will show if any regression is made in further pushes. adds tests to #14422
2 parents d19c651 + aa2f48b commit dbc0755

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

tests/ui/cognitive_complexity.rs

+3-1
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

+17-1
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)