1- error: the function has a cognitive complexity of 28
1+ error: the function has a cognitive complexity of 54
22 --> $DIR/cognitive_complexity.rs:6:1
33 |
44LL | / fn main() {
@@ -13,7 +13,7 @@ LL | | }
1313 = note: `-D clippy::cognitive-complexity` implied by `-D warnings`
1414 = help: you could split it up into multiple smaller functions
1515
16- error: the function has a cognitive complexity of 7
16+ error: the function has a cognitive complexity of 11
1717 --> $DIR/cognitive_complexity.rs:91:1
1818 |
1919LL | / fn kaboom() {
@@ -27,29 +27,9 @@ LL | | }
2727 |
2828 = help: you could split it up into multiple smaller functions
2929
30- error: the function has a cognitive complexity of 1
30+ error: the function has a cognitive complexity of 5
3131 --> $DIR/cognitive_complexity.rs:137:1
3232 |
33- LL | / fn lots_of_short_circuits() -> bool {
34- LL | | true && false && true && false && true && false && true
35- LL | | }
36- | |_^
37- |
38- = help: you could split it up into multiple smaller functions
39-
40- error: the function has a cognitive complexity of 1
41- --> $DIR/cognitive_complexity.rs:142:1
42- |
43- LL | / fn lots_of_short_circuits2() -> bool {
44- LL | | true || false || true || false || true || false || true
45- LL | | }
46- | |_^
47- |
48- = help: you could split it up into multiple smaller functions
49-
50- error: the function has a cognitive complexity of 2
51- --> $DIR/cognitive_complexity.rs:147:1
52- |
5333LL | / fn baa() {
5434LL | | let x = || match 99 {
5535LL | | 0 => 0,
@@ -61,23 +41,8 @@ LL | | }
6141 |
6242 = help: you could split it up into multiple smaller functions
6343
64- error: the function has a cognitive complexity of 2
65- --> $DIR/cognitive_complexity.rs:148:13
66- |
67- LL | let x = || match 99 {
68- | _____________^
69- LL | | 0 => 0,
70- LL | | 1 => 1,
71- LL | | 2 => 2,
72- ... |
73- LL | | _ => 42,
74- LL | | };
75- | |_____^
76- |
77- = help: you could split it up into multiple smaller functions
78-
79- error: the function has a cognitive complexity of 2
80- --> $DIR/cognitive_complexity.rs:165:1
44+ error: the function has a cognitive complexity of 3
45+ --> $DIR/cognitive_complexity.rs:155:1
8146 |
8247LL | / fn bar() {
8348LL | | match 99 {
@@ -89,8 +54,8 @@ LL | | }
8954 |
9055 = help: you could split it up into multiple smaller functions
9156
92- error: the function has a cognitive complexity of 2
93- --> $DIR/cognitive_complexity.rs:184 :1
57+ error: the function has a cognitive complexity of 5
58+ --> $DIR/cognitive_complexity.rs:174 :1
9459 |
9560LL | / fn barr() {
9661LL | | match 99 {
@@ -103,8 +68,8 @@ LL | | }
10368 |
10469 = help: you could split it up into multiple smaller functions
10570
106- error: the function has a cognitive complexity of 3
107- --> $DIR/cognitive_complexity.rs:194 :1
71+ error: the function has a cognitive complexity of 10
72+ --> $DIR/cognitive_complexity.rs:184 :1
10873 |
10974LL | / fn barr2() {
11075LL | | match 99 {
@@ -117,8 +82,8 @@ LL | | }
11782 |
11883 = help: you could split it up into multiple smaller functions
11984
120- error: the function has a cognitive complexity of 2
121- --> $DIR/cognitive_complexity.rs:210 :1
85+ error: the function has a cognitive complexity of 5
86+ --> $DIR/cognitive_complexity.rs:200 :1
12287 |
12388LL | / fn barrr() {
12489LL | | match 99 {
@@ -131,8 +96,8 @@ LL | | }
13196 |
13297 = help: you could split it up into multiple smaller functions
13398
134- error: the function has a cognitive complexity of 3
135- --> $DIR/cognitive_complexity.rs:220 :1
99+ error: the function has a cognitive complexity of 10
100+ --> $DIR/cognitive_complexity.rs:210 :1
136101 |
137102LL | / fn barrr2() {
138103LL | | match 99 {
@@ -145,8 +110,8 @@ LL | | }
145110 |
146111 = help: you could split it up into multiple smaller functions
147112
148- error: the function has a cognitive complexity of 2
149- --> $DIR/cognitive_complexity.rs:236 :1
113+ error: the function has a cognitive complexity of 5
114+ --> $DIR/cognitive_complexity.rs:226 :1
150115 |
151116LL | / fn barrrr() {
152117LL | | match 99 {
@@ -159,8 +124,8 @@ LL | | }
159124 |
160125 = help: you could split it up into multiple smaller functions
161126
162- error: the function has a cognitive complexity of 3
163- --> $DIR/cognitive_complexity.rs:246 :1
127+ error: the function has a cognitive complexity of 10
128+ --> $DIR/cognitive_complexity.rs:236 :1
164129 |
165130LL | / fn barrrr2() {
166131LL | | match 99 {
@@ -173,8 +138,8 @@ LL | | }
173138 |
174139 = help: you could split it up into multiple smaller functions
175140
176- error: the function has a cognitive complexity of 2
177- --> $DIR/cognitive_complexity.rs:262 :1
141+ error: the function has a cognitive complexity of 4
142+ --> $DIR/cognitive_complexity.rs:252 :1
178143 |
179144LL | / fn cake() {
180145LL | | if 4 == 5 {
@@ -187,8 +152,8 @@ LL | | }
187152 |
188153 = help: you could split it up into multiple smaller functions
189154
190- error: the function has a cognitive complexity of 4
191- --> $DIR/cognitive_complexity.rs:272 :1
155+ error: the function has a cognitive complexity of 10
156+ --> $DIR/cognitive_complexity.rs:262 :1
192157 |
193158LL | / pub fn read_file(input_path: &str) -> String {
194159LL | | use std::fs::File;
@@ -201,8 +166,8 @@ LL | | }
201166 |
202167 = help: you could split it up into multiple smaller functions
203168
204- error: the function has a cognitive complexity of 1
205- --> $DIR/cognitive_complexity.rs:303 :1
169+ error: the function has a cognitive complexity of 2
170+ --> $DIR/cognitive_complexity.rs:293 :1
206171 |
207172LL | / fn void(void: Void) {
208173LL | | if true {
@@ -213,8 +178,19 @@ LL | | }
213178 |
214179 = help: you could split it up into multiple smaller functions
215180
216- error: the function has a cognitive complexity of 1
217- --> $DIR/cognitive_complexity.rs:316:1
181+ error: the function has a cognitive complexity of 2
182+ --> $DIR/cognitive_complexity.rs:300:1
183+ |
184+ LL | / fn mcarton_sees_all() {
185+ LL | | panic!("meh");
186+ LL | | panic!("möh");
187+ LL | | }
188+ | |_^
189+ |
190+ = help: you could split it up into multiple smaller functions
191+
192+ error: the function has a cognitive complexity of 2
193+ --> $DIR/cognitive_complexity.rs:306:1
218194 |
219195LL | / fn try() -> Result<i32, &'static str> {
220196LL | | match 5 {
@@ -226,8 +202,8 @@ LL | | }
226202 |
227203 = help: you could split it up into multiple smaller functions
228204
229- error: the function has a cognitive complexity of 1
230- --> $DIR/cognitive_complexity.rs:324 :1
205+ error: the function has a cognitive complexity of 10
206+ --> $DIR/cognitive_complexity.rs:314 :1
231207 |
232208LL | / fn try_again() -> Result<i32, &'static str> {
233209LL | | let _ = try!(Ok(42));
@@ -240,29 +216,45 @@ LL | | }
240216 |
241217 = help: you could split it up into multiple smaller functions
242218
243- error: the function has a cognitive complexity of 1
244- --> $DIR/cognitive_complexity.rs:340 :1
219+ error: the function has a cognitive complexity of 13
220+ --> $DIR/cognitive_complexity.rs:344 :1
245221 |
246- LL | / fn early () -> Result< i32, &'static str> {
247- LL | | return Ok(5) ;
248- LL | | return Ok(5) ;
249- LL | | return Ok(5) ;
222+ LL | / fn early_ret () -> i32 {
223+ LL | | let a = if true { 42 } else { return 0; } ;
224+ LL | | let a = if a < 99 { 42 } else { return 0; } ;
225+ LL | | let a = if a < 99 { 42 } else { return 0; } ;
250226... |
251- LL | | return Ok(5);
227+ LL | | }
252228LL | | }
253229 | |_^
254230 |
255231 = help: you could split it up into multiple smaller functions
256232
257- error: the function has a cognitive complexity of 8
258- --> $DIR/cognitive_complexity.rs:354 :1
233+ error: the function has a cognitive complexity of 2
234+ --> $DIR/cognitive_complexity.rs:364 :1
259235 |
260- LL | / fn early_ret() -> i32 {
261- LL | | let a = if true { 42 } else { return 0; };
262- LL | | let a = if a < 99 { 42 } else { return 0; };
263- LL | | let a = if a < 99 { 42 } else { return 0; };
264- ... |
265- LL | | }
236+ LL | / fn osscilating_logical_chain_1() -> bool {
237+ LL | | true && false || true && false
238+ LL | | }
239+ | |_^
240+ |
241+ = help: you could split it up into multiple smaller functions
242+
243+ error: the function has a cognitive complexity of 2
244+ --> $DIR/cognitive_complexity.rs:371:1
245+ |
246+ LL | / fn osscilating_logical_chain_2() -> bool {
247+ LL | | true && false && true && false || true && false && true && false
248+ LL | | }
249+ | |_^
250+ |
251+ = help: you could split it up into multiple smaller functions
252+
253+ error: the function has a cognitive complexity of 2
254+ --> $DIR/cognitive_complexity.rs:376:1
255+ |
256+ LL | / fn osscilating_logical_chain_3() -> bool {
257+ LL | | (true && false) || (true && false)
266258LL | | }
267259 | |_^
268260 |
0 commit comments