|
1 | 1 | error: the function has a cognitive complexity of (28/25) |
2 | | - --> $DIR/cognitive_complexity.rs:6:1 |
| 2 | + --> $DIR/cognitive_complexity.rs:6:4 |
3 | 3 | | |
4 | | -LL | / fn main() { |
5 | | -LL | | if true { |
6 | | -LL | | println!("a"); |
7 | | -LL | | } |
8 | | -... | |
9 | | -LL | | } |
10 | | -LL | | } |
11 | | - | |_^ |
| 4 | +LL | fn main() { |
| 5 | + | ^^^^ |
12 | 6 | | |
13 | 7 | = note: `-D clippy::cognitive-complexity` implied by `-D warnings` |
14 | 8 | = help: you could split it up into multiple smaller functions |
15 | 9 |
|
16 | 10 | error: the function has a cognitive complexity of (7/1) |
17 | | - --> $DIR/cognitive_complexity.rs:91:1 |
| 11 | + --> $DIR/cognitive_complexity.rs:91:4 |
18 | 12 | | |
19 | | -LL | / fn kaboom() { |
20 | | -LL | | let n = 0; |
21 | | -LL | | 'a: for i in 0..20 { |
22 | | -LL | | 'b: for j in i..20 { |
23 | | -... | |
24 | | -LL | | } |
25 | | -LL | | } |
26 | | - | |_^ |
| 13 | +LL | fn kaboom() { |
| 14 | + | ^^^^^^ |
27 | 15 | | |
28 | 16 | = help: you could split it up into multiple smaller functions |
29 | 17 |
|
30 | 18 | error: the function has a cognitive complexity of (2/1) |
31 | | - --> $DIR/cognitive_complexity.rs:149:1 |
| 19 | + --> $DIR/cognitive_complexity.rs:149:4 |
32 | 20 | | |
33 | | -LL | / fn baa() { |
34 | | -LL | | let x = || match 99 { |
35 | | -LL | | 0 => 0, |
36 | | -LL | | 1 => 1, |
37 | | -... | |
38 | | -LL | | } |
39 | | -LL | | } |
40 | | - | |_^ |
| 21 | +LL | fn baa() { |
| 22 | + | ^^^ |
41 | 23 | | |
42 | 24 | = help: you could split it up into multiple smaller functions |
43 | 25 |
|
44 | 26 | error: the function has a cognitive complexity of (2/1) |
45 | 27 | --> $DIR/cognitive_complexity.rs:150:13 |
46 | 28 | | |
47 | | -LL | let x = || match 99 { |
48 | | - | _____________^ |
49 | | -LL | | 0 => 0, |
50 | | -LL | | 1 => 1, |
51 | | -LL | | 2 => 2, |
52 | | -... | |
53 | | -LL | | _ => 42, |
54 | | -LL | | }; |
55 | | - | |_____^ |
| 29 | +LL | let x = || match 99 { |
| 30 | + | ^^ |
56 | 31 | | |
57 | 32 | = help: you could split it up into multiple smaller functions |
58 | 33 |
|
59 | 34 | error: the function has a cognitive complexity of (2/1) |
60 | | - --> $DIR/cognitive_complexity.rs:167:1 |
| 35 | + --> $DIR/cognitive_complexity.rs:167:4 |
61 | 36 | | |
62 | | -LL | / fn bar() { |
63 | | -LL | | match 99 { |
64 | | -LL | | 0 => println!("hi"), |
65 | | -LL | | _ => println!("bye"), |
66 | | -LL | | } |
67 | | -LL | | } |
68 | | - | |_^ |
| 37 | +LL | fn bar() { |
| 38 | + | ^^^ |
69 | 39 | | |
70 | 40 | = help: you could split it up into multiple smaller functions |
71 | 41 |
|
72 | 42 | error: the function has a cognitive complexity of (2/1) |
73 | | - --> $DIR/cognitive_complexity.rs:186:1 |
| 43 | + --> $DIR/cognitive_complexity.rs:186:4 |
74 | 44 | | |
75 | | -LL | / fn barr() { |
76 | | -LL | | match 99 { |
77 | | -LL | | 0 => println!("hi"), |
78 | | -LL | | 1 => println!("bla"), |
79 | | -... | |
80 | | -LL | | } |
81 | | -LL | | } |
82 | | - | |_^ |
| 45 | +LL | fn barr() { |
| 46 | + | ^^^^ |
83 | 47 | | |
84 | 48 | = help: you could split it up into multiple smaller functions |
85 | 49 |
|
86 | 50 | error: the function has a cognitive complexity of (3/1) |
87 | | - --> $DIR/cognitive_complexity.rs:196:1 |
| 51 | + --> $DIR/cognitive_complexity.rs:196:4 |
88 | 52 | | |
89 | | -LL | / fn barr2() { |
90 | | -LL | | match 99 { |
91 | | -LL | | 0 => println!("hi"), |
92 | | -LL | | 1 => println!("bla"), |
93 | | -... | |
94 | | -LL | | } |
95 | | -LL | | } |
96 | | - | |_^ |
| 53 | +LL | fn barr2() { |
| 54 | + | ^^^^^ |
97 | 55 | | |
98 | 56 | = help: you could split it up into multiple smaller functions |
99 | 57 |
|
100 | 58 | error: the function has a cognitive complexity of (2/1) |
101 | | - --> $DIR/cognitive_complexity.rs:212:1 |
| 59 | + --> $DIR/cognitive_complexity.rs:212:4 |
102 | 60 | | |
103 | | -LL | / fn barrr() { |
104 | | -LL | | match 99 { |
105 | | -LL | | 0 => println!("hi"), |
106 | | -LL | | 1 => panic!("bla"), |
107 | | -... | |
108 | | -LL | | } |
109 | | -LL | | } |
110 | | - | |_^ |
| 61 | +LL | fn barrr() { |
| 62 | + | ^^^^^ |
111 | 63 | | |
112 | 64 | = help: you could split it up into multiple smaller functions |
113 | 65 |
|
114 | 66 | error: the function has a cognitive complexity of (3/1) |
115 | | - --> $DIR/cognitive_complexity.rs:222:1 |
| 67 | + --> $DIR/cognitive_complexity.rs:222:4 |
116 | 68 | | |
117 | | -LL | / fn barrr2() { |
118 | | -LL | | match 99 { |
119 | | -LL | | 0 => println!("hi"), |
120 | | -LL | | 1 => panic!("bla"), |
121 | | -... | |
122 | | -LL | | } |
123 | | -LL | | } |
124 | | - | |_^ |
| 69 | +LL | fn barrr2() { |
| 70 | + | ^^^^^^ |
125 | 71 | | |
126 | 72 | = help: you could split it up into multiple smaller functions |
127 | 73 |
|
128 | 74 | error: the function has a cognitive complexity of (2/1) |
129 | | - --> $DIR/cognitive_complexity.rs:238:1 |
| 75 | + --> $DIR/cognitive_complexity.rs:238:4 |
130 | 76 | | |
131 | | -LL | / fn barrrr() { |
132 | | -LL | | match 99 { |
133 | | -LL | | 0 => println!("hi"), |
134 | | -LL | | 1 => println!("bla"), |
135 | | -... | |
136 | | -LL | | } |
137 | | -LL | | } |
138 | | - | |_^ |
| 77 | +LL | fn barrrr() { |
| 78 | + | ^^^^^^ |
139 | 79 | | |
140 | 80 | = help: you could split it up into multiple smaller functions |
141 | 81 |
|
142 | 82 | error: the function has a cognitive complexity of (3/1) |
143 | | - --> $DIR/cognitive_complexity.rs:248:1 |
| 83 | + --> $DIR/cognitive_complexity.rs:248:4 |
144 | 84 | | |
145 | | -LL | / fn barrrr2() { |
146 | | -LL | | match 99 { |
147 | | -LL | | 0 => println!("hi"), |
148 | | -LL | | 1 => println!("bla"), |
149 | | -... | |
150 | | -LL | | } |
151 | | -LL | | } |
152 | | - | |_^ |
| 85 | +LL | fn barrrr2() { |
| 86 | + | ^^^^^^^ |
153 | 87 | | |
154 | 88 | = help: you could split it up into multiple smaller functions |
155 | 89 |
|
156 | 90 | error: the function has a cognitive complexity of (2/1) |
157 | | - --> $DIR/cognitive_complexity.rs:264:1 |
| 91 | + --> $DIR/cognitive_complexity.rs:264:4 |
158 | 92 | | |
159 | | -LL | / fn cake() { |
160 | | -LL | | if 4 == 5 { |
161 | | -LL | | println!("yea"); |
162 | | -LL | | } else { |
163 | | -... | |
164 | | -LL | | println!("whee"); |
165 | | -LL | | } |
166 | | - | |_^ |
| 93 | +LL | fn cake() { |
| 94 | + | ^^^^ |
167 | 95 | | |
168 | 96 | = help: you could split it up into multiple smaller functions |
169 | 97 |
|
170 | 98 | error: the function has a cognitive complexity of (4/1) |
171 | | - --> $DIR/cognitive_complexity.rs:274:1 |
| 99 | + --> $DIR/cognitive_complexity.rs:274:8 |
172 | 100 | | |
173 | | -LL | / pub fn read_file(input_path: &str) -> String { |
174 | | -LL | | use std::fs::File; |
175 | | -LL | | use std::io::{Read, Write}; |
176 | | -LL | | use std::path::Path; |
177 | | -... | |
178 | | -LL | | } |
179 | | -LL | | } |
180 | | - | |_^ |
| 101 | +LL | pub fn read_file(input_path: &str) -> String { |
| 102 | + | ^^^^^^^^^ |
181 | 103 | | |
182 | 104 | = help: you could split it up into multiple smaller functions |
183 | 105 |
|
184 | 106 | error: the function has a cognitive complexity of (2/1) |
185 | | - --> $DIR/cognitive_complexity.rs:305:1 |
| 107 | + --> $DIR/cognitive_complexity.rs:305:4 |
186 | 108 | | |
187 | | -LL | / fn void(void: Void) { |
188 | | -LL | | if true { |
189 | | -LL | | match void {} |
190 | | -LL | | } |
191 | | -LL | | } |
192 | | - | |_^ |
| 109 | +LL | fn void(void: Void) { |
| 110 | + | ^^^^ |
193 | 111 | | |
194 | 112 | = help: you could split it up into multiple smaller functions |
195 | 113 |
|
196 | 114 | error: the function has a cognitive complexity of (8/1) |
197 | | - --> $DIR/cognitive_complexity.rs:356:1 |
| 115 | + --> $DIR/cognitive_complexity.rs:356:4 |
198 | 116 | | |
199 | | -LL | / fn early_ret() -> i32 { |
200 | | -LL | | let a = if true { 42 } else { return 0; }; |
201 | | -LL | | let a = if a < 99 { 42 } else { return 0; }; |
202 | | -LL | | let a = if a < 99 { 42 } else { return 0; }; |
203 | | -... | |
204 | | -LL | | } |
205 | | -LL | | } |
206 | | - | |_^ |
| 117 | +LL | fn early_ret() -> i32 { |
| 118 | + | ^^^^^^^^^ |
207 | 119 | | |
208 | 120 | = help: you could split it up into multiple smaller functions |
209 | 121 |
|
210 | | -error: aborting due to 15 previous errors |
| 122 | +error: the function has a cognitive complexity of (2/1) |
| 123 | + --> $DIR/cognitive_complexity.rs:377:13 |
| 124 | + | |
| 125 | +LL | let x = |a: i32, b: i32| -> i32 { |
| 126 | + | ^^^^^^^^^^^^^^^^ |
| 127 | + | |
| 128 | + = help: you could split it up into multiple smaller functions |
| 129 | + |
| 130 | +error: the function has a cognitive complexity of (2/1) |
| 131 | + --> $DIR/cognitive_complexity.rs:390:8 |
| 132 | + | |
| 133 | +LL | fn moo(&self) { |
| 134 | + | ^^^ |
| 135 | + | |
| 136 | + = help: you could split it up into multiple smaller functions |
| 137 | + |
| 138 | +error: aborting due to 17 previous errors |
211 | 139 |
|
0 commit comments