about summary refs log tree commit diff
path: root/tests/ui
diff options
context:
space:
mode:
authorkoka <koka.code@gmail.com>2022-11-11 00:14:18 +0900
committerkoka <koka.code@gmail.com>2022-11-11 00:14:18 +0900
commit2bc04bdac26fbb49e3b4ef3673f6a5143df307e7 (patch)
tree54d071d92194121436302aed9370a4853b9faa56 /tests/ui
parent432baf7026aa896cfe3d44705537879ab2202bfb (diff)
downloadrust-2bc04bdac26fbb49e3b4ef3673f6a5143df307e7.tar.gz
rust-2bc04bdac26fbb49e3b4ef3673f6a5143df307e7.zip
fix: cognitive_complexity for async fn
Diffstat (limited to 'tests/ui')
-rw-r--r--tests/ui/cognitive_complexity.rs8
-rw-r--r--tests/ui/cognitive_complexity.stderr10
2 files changed, 17 insertions, 1 deletions
diff --git a/tests/ui/cognitive_complexity.rs b/tests/ui/cognitive_complexity.rs
index 912e6788afd..498a9f0644f 100644
--- a/tests/ui/cognitive_complexity.rs
+++ b/tests/ui/cognitive_complexity.rs
@@ -393,3 +393,11 @@ impl Moo {
         }
     }
 }
+
+#[clippy::cognitive_complexity = "1"]
+mod issue9300 {
+    async fn a() {
+        let a = 0;
+        if a == 0 {}
+    }
+}
diff --git a/tests/ui/cognitive_complexity.stderr b/tests/ui/cognitive_complexity.stderr
index d7f2f24e52f..208f4d7b347 100644
--- a/tests/ui/cognitive_complexity.stderr
+++ b/tests/ui/cognitive_complexity.stderr
@@ -135,5 +135,13 @@ LL |     fn moo(&self) {
    |
    = help: you could split it up into multiple smaller functions
 
-error: aborting due to 17 previous errors
+error: the function has a cognitive complexity of (2/1)
+  --> $DIR/cognitive_complexity.rs:399:14
+   |
+LL |     async fn a() {
+   |              ^
+   |
+   = help: you could split it up into multiple smaller functions
+
+error: aborting due to 18 previous errors