1
- error: the function has a cognitive complexity of 28
1
+ error: the function has a cognitive complexity of 54
2
2
--> $DIR/cognitive_complexity.rs:6:1
3
3
|
4
4
LL | / fn main() {
@@ -13,7 +13,7 @@ LL | | }
13
13
= note: `-D clippy::cognitive-complexity` implied by `-D warnings`
14
14
= help: you could split it up into multiple smaller functions
15
15
16
- error: the function has a cognitive complexity of 7
16
+ error: the function has a cognitive complexity of 11
17
17
--> $DIR/cognitive_complexity.rs:91:1
18
18
|
19
19
LL | / fn kaboom() {
@@ -27,29 +27,9 @@ LL | | }
27
27
|
28
28
= help: you could split it up into multiple smaller functions
29
29
30
- error: the function has a cognitive complexity of 1
30
+ error: the function has a cognitive complexity of 5
31
31
--> $DIR/cognitive_complexity.rs:137:1
32
32
|
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
- |
53
33
LL | / fn baa() {
54
34
LL | | let x = || match 99 {
55
35
LL | | 0 => 0,
@@ -61,23 +41,8 @@ LL | | }
61
41
|
62
42
= help: you could split it up into multiple smaller functions
63
43
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
81
46
|
82
47
LL | / fn bar() {
83
48
LL | | match 99 {
@@ -89,8 +54,8 @@ LL | | }
89
54
|
90
55
= help: you could split it up into multiple smaller functions
91
56
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
94
59
|
95
60
LL | / fn barr() {
96
61
LL | | match 99 {
@@ -103,8 +68,8 @@ LL | | }
103
68
|
104
69
= help: you could split it up into multiple smaller functions
105
70
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
108
73
|
109
74
LL | / fn barr2() {
110
75
LL | | match 99 {
@@ -117,8 +82,8 @@ LL | | }
117
82
|
118
83
= help: you could split it up into multiple smaller functions
119
84
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
122
87
|
123
88
LL | / fn barrr() {
124
89
LL | | match 99 {
@@ -131,8 +96,8 @@ LL | | }
131
96
|
132
97
= help: you could split it up into multiple smaller functions
133
98
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
136
101
|
137
102
LL | / fn barrr2() {
138
103
LL | | match 99 {
@@ -145,8 +110,8 @@ LL | | }
145
110
|
146
111
= help: you could split it up into multiple smaller functions
147
112
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
150
115
|
151
116
LL | / fn barrrr() {
152
117
LL | | match 99 {
@@ -159,8 +124,8 @@ LL | | }
159
124
|
160
125
= help: you could split it up into multiple smaller functions
161
126
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
164
129
|
165
130
LL | / fn barrrr2() {
166
131
LL | | match 99 {
@@ -173,8 +138,8 @@ LL | | }
173
138
|
174
139
= help: you could split it up into multiple smaller functions
175
140
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
178
143
|
179
144
LL | / fn cake() {
180
145
LL | | if 4 == 5 {
@@ -187,8 +152,8 @@ LL | | }
187
152
|
188
153
= help: you could split it up into multiple smaller functions
189
154
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 11
156
+ --> $DIR/cognitive_complexity.rs:262 :1
192
157
|
193
158
LL | / pub fn read_file(input_path: &str) -> String {
194
159
LL | | use std::fs::File;
@@ -201,8 +166,8 @@ LL | | }
201
166
|
202
167
= help: you could split it up into multiple smaller functions
203
168
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
206
171
|
207
172
LL | / fn void(void: Void) {
208
173
LL | | if true {
@@ -213,8 +178,19 @@ LL | | }
213
178
|
214
179
= help: you could split it up into multiple smaller functions
215
180
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 3
193
+ --> $DIR/cognitive_complexity.rs:306:1
218
194
|
219
195
LL | / fn try() -> Result<i32, &'static str> {
220
196
LL | | match 5 {
@@ -226,8 +202,8 @@ LL | | }
226
202
|
227
203
= help: you could split it up into multiple smaller functions
228
204
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 11
206
+ --> $DIR/cognitive_complexity.rs:314 :1
231
207
|
232
208
LL | / fn try_again() -> Result<i32, &'static str> {
233
209
LL | | let _ = try!(Ok(42));
@@ -240,8 +216,8 @@ LL | | }
240
216
|
241
217
= help: you could split it up into multiple smaller functions
242
218
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 9
220
+ --> $DIR/cognitive_complexity.rs:330 :1
245
221
|
246
222
LL | / fn early() -> Result<i32, &'static str> {
247
223
LL | | return Ok(5);
@@ -254,8 +230,8 @@ LL | | }
254
230
|
255
231
= help: you could split it up into multiple smaller functions
256
232
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 13
234
+ --> $DIR/cognitive_complexity.rs:344 :1
259
235
|
260
236
LL | / fn early_ret() -> i32 {
261
237
LL | | let a = if true { 42 } else { return 0; };
@@ -268,5 +244,63 @@ LL | | }
268
244
|
269
245
= help: you could split it up into multiple smaller functions
270
246
271
- error: aborting due to 20 previous errors
247
+ error: the function has a cognitive complexity of 2
248
+ --> $DIR/cognitive_complexity.rs:364:1
249
+ |
250
+ LL | / fn osscilating_logical_chain_1() -> bool {
251
+ LL | | true && false || true && false
252
+ LL | | }
253
+ | |_^
254
+ |
255
+ = help: you could split it up into multiple smaller functions
256
+
257
+ error: the function has a cognitive complexity of 2
258
+ --> $DIR/cognitive_complexity.rs:371:1
259
+ |
260
+ LL | / fn osscilating_logical_chain_2() -> bool {
261
+ LL | | true && false && true && false || true && false && true && false
262
+ LL | | }
263
+ | |_^
264
+ |
265
+ = help: you could split it up into multiple smaller functions
266
+
267
+ error: the function has a cognitive complexity of 2
268
+ --> $DIR/cognitive_complexity.rs:376:1
269
+ |
270
+ LL | / fn osscilating_logical_chain_3() -> bool {
271
+ LL | | (true && false) || (true && false)
272
+ LL | | }
273
+ | |_^
274
+ |
275
+ = help: you could split it up into multiple smaller functions
276
+
277
+ error: the function has a cognitive complexity of 4
278
+ --> $DIR/cognitive_complexity.rs:381:1
279
+ |
280
+ LL | / fn nested_functions_are_counted(n: usize) -> usize {
281
+ LL | | fn lucas_number(n: usize) -> usize {
282
+ LL | | match n {
283
+ LL | | 0 => 2,
284
+ ... |
285
+ LL | | lucas_number(n)
286
+ LL | | }
287
+ | |_^
288
+ |
289
+ = help: you could split it up into multiple smaller functions
290
+
291
+ error: the function has a cognitive complexity of 3
292
+ --> $DIR/cognitive_complexity.rs:382:5
293
+ |
294
+ LL | / fn lucas_number(n: usize) -> usize {
295
+ LL | | match n {
296
+ LL | | 0 => 2,
297
+ LL | | 1 => 1,
298
+ LL | | _ => lucas_number(n - 1) + lucas_number(n - 2),
299
+ LL | | }
300
+ LL | | }
301
+ | |_____^
302
+ |
303
+ = help: you could split it up into multiple smaller functions
304
+
305
+ error: aborting due to 23 previous errors
272
306
0 commit comments