]> git.lizzy.rs Git - rust.git/blob - tests/ui/cyclomatic_complexity.stderr
Merge branch 'master' into rustfmt_tests
[rust.git] / tests / ui / cyclomatic_complexity.stderr
1 error: the function has a cyclomatic complexity of 28
2   --> $DIR/cyclomatic_complexity.rs:15:1
3    |
4 15 | / fn main() {
5 16 | |     if true {
6 17 | |         println!("a");
7 18 | |     }
8 ...  |
9 96 | |     }
10 97 | | }
11    | |_^
12    |
13    = note: `-D clippy::cyclomatic-complexity` implied by `-D warnings`
14    = help: you could split it up into multiple smaller functions
15
16 error: the function has a cyclomatic complexity of 7
17    --> $DIR/cyclomatic_complexity.rs:100:1
18     |
19 100 | / fn kaboom() {
20 101 | |     let n = 0;
21 102 | |     'a: for i in 0..20 {
22 103 | |         'b: for j in i..20 {
23 ...   |
24 118 | |     }
25 119 | | }
26     | |_^
27     |
28     = help: you could split it up into multiple smaller functions
29
30 error: the function has a cyclomatic complexity of 1
31    --> $DIR/cyclomatic_complexity.rs:146:1
32     |
33 146 | / fn lots_of_short_circuits() -> bool {
34 147 | |     true && false && true && false && true && false && true
35 148 | | }
36     | |_^
37     |
38     = help: you could split it up into multiple smaller functions
39
40 error: the function has a cyclomatic complexity of 1
41    --> $DIR/cyclomatic_complexity.rs:151:1
42     |
43 151 | / fn lots_of_short_circuits2() -> bool {
44 152 | |     true || false || true || false || true || false || true
45 153 | | }
46     | |_^
47     |
48     = help: you could split it up into multiple smaller functions
49
50 error: the function has a cyclomatic complexity of 2
51    --> $DIR/cyclomatic_complexity.rs:156:1
52     |
53 156 | / fn baa() {
54 157 | |     let x = || match 99 {
55 158 | |         0 => 0,
56 159 | |         1 => 1,
57 ...   |
58 170 | |     }
59 171 | | }
60     | |_^
61     |
62     = help: you could split it up into multiple smaller functions
63
64 error: the function has a cyclomatic complexity of 2
65    --> $DIR/cyclomatic_complexity.rs:157:13
66     |
67 157 |       let x = || match 99 {
68     |  _____________^
69 158 | |         0 => 0,
70 159 | |         1 => 1,
71 160 | |         2 => 2,
72 ...   |
73 164 | |         _ => 42,
74 165 | |     };
75     | |_____^
76     |
77     = help: you could split it up into multiple smaller functions
78
79 error: the function has a cyclomatic complexity of 2
80    --> $DIR/cyclomatic_complexity.rs:174:1
81     |
82 174 | / fn bar() {
83 175 | |     match 99 {
84 176 | |         0 => println!("hi"),
85 177 | |         _ => println!("bye"),
86 178 | |     }
87 179 | | }
88     | |_^
89     |
90     = help: you could split it up into multiple smaller functions
91
92 error: the function has a cyclomatic complexity of 2
93    --> $DIR/cyclomatic_complexity.rs:193:1
94     |
95 193 | / fn barr() {
96 194 | |     match 99 {
97 195 | |         0 => println!("hi"),
98 196 | |         1 => println!("bla"),
99 ...   |
100 199 | |     }
101 200 | | }
102     | |_^
103     |
104     = help: you could split it up into multiple smaller functions
105
106 error: the function has a cyclomatic complexity of 3
107    --> $DIR/cyclomatic_complexity.rs:203:1
108     |
109 203 | / fn barr2() {
110 204 | |     match 99 {
111 205 | |         0 => println!("hi"),
112 206 | |         1 => println!("bla"),
113 ...   |
114 215 | |     }
115 216 | | }
116     | |_^
117     |
118     = help: you could split it up into multiple smaller functions
119
120 error: the function has a cyclomatic complexity of 2
121    --> $DIR/cyclomatic_complexity.rs:219:1
122     |
123 219 | / fn barrr() {
124 220 | |     match 99 {
125 221 | |         0 => println!("hi"),
126 222 | |         1 => panic!("bla"),
127 ...   |
128 225 | |     }
129 226 | | }
130     | |_^
131     |
132     = help: you could split it up into multiple smaller functions
133
134 error: the function has a cyclomatic complexity of 3
135    --> $DIR/cyclomatic_complexity.rs:229:1
136     |
137 229 | / fn barrr2() {
138 230 | |     match 99 {
139 231 | |         0 => println!("hi"),
140 232 | |         1 => panic!("bla"),
141 ...   |
142 241 | |     }
143 242 | | }
144     | |_^
145     |
146     = help: you could split it up into multiple smaller functions
147
148 error: the function has a cyclomatic complexity of 2
149    --> $DIR/cyclomatic_complexity.rs:245:1
150     |
151 245 | / fn barrrr() {
152 246 | |     match 99 {
153 247 | |         0 => println!("hi"),
154 248 | |         1 => println!("bla"),
155 ...   |
156 251 | |     }
157 252 | | }
158     | |_^
159     |
160     = help: you could split it up into multiple smaller functions
161
162 error: the function has a cyclomatic complexity of 3
163    --> $DIR/cyclomatic_complexity.rs:255:1
164     |
165 255 | / fn barrrr2() {
166 256 | |     match 99 {
167 257 | |         0 => println!("hi"),
168 258 | |         1 => println!("bla"),
169 ...   |
170 267 | |     }
171 268 | | }
172     | |_^
173     |
174     = help: you could split it up into multiple smaller functions
175
176 error: the function has a cyclomatic complexity of 2
177    --> $DIR/cyclomatic_complexity.rs:271:1
178     |
179 271 | / fn cake() {
180 272 | |     if 4 == 5 {
181 273 | |         println!("yea");
182 274 | |     } else {
183 ...   |
184 277 | |     println!("whee");
185 278 | | }
186     | |_^
187     |
188     = help: you could split it up into multiple smaller functions
189
190 error: the function has a cyclomatic complexity of 4
191    --> $DIR/cyclomatic_complexity.rs:281:1
192     |
193 281 | / pub fn read_file(input_path: &str) -> String {
194 282 | |     use std::fs::File;
195 283 | |     use std::io::{Read, Write};
196 284 | |     use std::path::Path;
197 ...   |
198 306 | |     }
199 307 | | }
200     | |_^
201     |
202     = help: you could split it up into multiple smaller functions
203
204 error: the function has a cyclomatic complexity of 1
205    --> $DIR/cyclomatic_complexity.rs:312:1
206     |
207 312 | / fn void(void: Void) {
208 313 | |     if true {
209 314 | |         match void {}
210 315 | |     }
211 316 | | }
212     | |_^
213     |
214     = help: you could split it up into multiple smaller functions
215
216 error: the function has a cyclomatic complexity of 1
217    --> $DIR/cyclomatic_complexity.rs:325:1
218     |
219 325 | / fn try() -> Result<i32, &'static str> {
220 326 | |     match 5 {
221 327 | |         5 => Ok(5),
222 328 | |         _ => return Err("bla"),
223 329 | |     }
224 330 | | }
225     | |_^
226     |
227     = help: you could split it up into multiple smaller functions
228
229 error: the function has a cyclomatic complexity of 1
230    --> $DIR/cyclomatic_complexity.rs:333:1
231     |
232 333 | / fn try_again() -> Result<i32, &'static str> {
233 334 | |     let _ = try!(Ok(42));
234 335 | |     let _ = try!(Ok(43));
235 336 | |     let _ = try!(Ok(44));
236 ...   |
237 345 | |     }
238 346 | | }
239     | |_^
240     |
241     = help: you could split it up into multiple smaller functions
242
243 error: the function has a cyclomatic complexity of 1
244    --> $DIR/cyclomatic_complexity.rs:349:1
245     |
246 349 | / fn early() -> Result<i32, &'static str> {
247 350 | |     return Ok(5);
248 351 | |     return Ok(5);
249 352 | |     return Ok(5);
250 ...   |
251 358 | |     return Ok(5);
252 359 | | }
253     | |_^
254     |
255     = help: you could split it up into multiple smaller functions
256
257 error: the function has a cyclomatic complexity of 8
258    --> $DIR/cyclomatic_complexity.rs:363:1
259     |
260 363 | / fn early_ret() -> i32 {
261 364 | |     let a = if true { 42 } else { return 0; };
262 365 | |     let a = if a < 99 { 42 } else { return 0; };
263 366 | |     let a = if a < 99 { 42 } else { return 0; };
264 ...   |
265 379 | |     }
266 380 | | }
267     | |_^
268     |
269     = help: you could split it up into multiple smaller functions
270
271 error: aborting due to 20 previous errors
272