From c7fbcf4c339aa2162ed42d7beea1e927c2cd6c0e Mon Sep 17 00:00:00 2001 From: cerdelen Date: Fri, 11 Apr 2025 09:30:28 +0200 Subject: [PATCH] Test for Multiple return statements doesnt decrease cognitive complexity --- tests/ui/cognitive_complexity.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/ui/cognitive_complexity.rs b/tests/ui/cognitive_complexity.rs index 2dbec955f63f..88033a7b6741 100644 --- a/tests/ui/cognitive_complexity.rs +++ b/tests/ui/cognitive_complexity.rs @@ -448,3 +448,20 @@ mod issue9300 { } } } + +#[clippy::cognitive_complexity = "2"] +mod issue14422 { + fn foo() { + for _ in 0..10 { + println!("hello there"); + } + } + + fn bar() { + for _ in 0..10 { + println!("hello there"); + } + return; + return; + } +}