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 https://github.com/rust-lang/rust-clippy/issues/14422
This commit is contained in:
Alex Macleod 2025-04-13 13:54:25 +00:00 committed by GitHub
commit dbc07558ef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 2 deletions

View file

@ -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");
}

View file

@ -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