rust-clippy/tests/ui/cyclomatic_complexity.stderr

274 lines
6.7 KiB
Text
Raw Normal View History

error: the function has a cyclomatic complexity of 28
2018-12-09 16:17:58 +00:00
--> $DIR/cyclomatic_complexity.rs:16:1
|
2018-12-09 16:17:58 +00:00
16 | / fn main() {
17 | | if true {
18 | | println!("a");
19 | | }
... |
2018-12-09 16:17:58 +00:00
97 | | }
98 | | }
| |_^
|
= note: `-D clippy::cyclomatic-complexity` implied by `-D warnings`
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 7
2018-12-09 16:17:58 +00:00
--> $DIR/cyclomatic_complexity.rs:101:1
|
2018-12-09 16:17:58 +00:00
101 | / fn kaboom() {
102 | | let n = 0;
103 | | 'a: for i in 0..20 {
104 | | 'b: for j in i..20 {
... |
2018-12-09 16:17:58 +00:00
119 | | }
120 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 1
2018-12-09 16:17:58 +00:00
--> $DIR/cyclomatic_complexity.rs:147:1
|
2018-12-09 16:17:58 +00:00
147 | / fn lots_of_short_circuits() -> bool {
148 | | true && false && true && false && true && false && true
149 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 1
2018-12-09 16:17:58 +00:00
--> $DIR/cyclomatic_complexity.rs:152:1
|
2018-12-09 16:17:58 +00:00
152 | / fn lots_of_short_circuits2() -> bool {
153 | | true || false || true || false || true || false || true
154 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 2
2018-12-09 16:17:58 +00:00
--> $DIR/cyclomatic_complexity.rs:157:1
|
2018-12-09 16:17:58 +00:00
157 | / fn baa() {
158 | | let x = || match 99 {
159 | | 0 => 0,
160 | | 1 => 1,
... |
2018-12-09 16:17:58 +00:00
171 | | }
172 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 2
2018-12-09 16:17:58 +00:00
--> $DIR/cyclomatic_complexity.rs:158:13
|
2018-12-09 16:17:58 +00:00
158 | let x = || match 99 {
| _____________^
2018-12-09 16:17:58 +00:00
159 | | 0 => 0,
160 | | 1 => 1,
161 | | 2 => 2,
... |
2018-12-09 16:17:58 +00:00
165 | | _ => 42,
166 | | };
| |_____^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 2
2018-12-09 16:17:58 +00:00
--> $DIR/cyclomatic_complexity.rs:175:1
|
175 | / fn bar() {
176 | | match 99 {
177 | | 0 => println!("hi"),
178 | | _ => println!("bye"),
179 | | }
180 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 2
2018-12-09 16:17:58 +00:00
--> $DIR/cyclomatic_complexity.rs:194:1
|
2018-12-09 16:17:58 +00:00
194 | / fn barr() {
195 | | match 99 {
196 | | 0 => println!("hi"),
197 | | 1 => println!("bla"),
... |
2018-12-09 16:17:58 +00:00
200 | | }
201 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
2018-10-06 16:18:06 +00:00
error: the function has a cyclomatic complexity of 3
2018-12-09 16:17:58 +00:00
--> $DIR/cyclomatic_complexity.rs:204:1
|
2018-12-09 16:17:58 +00:00
204 | / fn barr2() {
205 | | match 99 {
206 | | 0 => println!("hi"),
207 | | 1 => println!("bla"),
... |
2018-12-09 16:17:58 +00:00
216 | | }
217 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
2018-10-06 16:18:06 +00:00
error: the function has a cyclomatic complexity of 2
2018-12-09 16:17:58 +00:00
--> $DIR/cyclomatic_complexity.rs:220:1
|
2018-12-09 16:17:58 +00:00
220 | / fn barrr() {
221 | | match 99 {
222 | | 0 => println!("hi"),
223 | | 1 => panic!("bla"),
... |
2018-12-09 16:17:58 +00:00
226 | | }
227 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
2018-10-06 16:18:06 +00:00
error: the function has a cyclomatic complexity of 3
2018-12-09 16:17:58 +00:00
--> $DIR/cyclomatic_complexity.rs:230:1
|
2018-12-09 16:17:58 +00:00
230 | / fn barrr2() {
231 | | match 99 {
232 | | 0 => println!("hi"),
233 | | 1 => panic!("bla"),
... |
2018-12-09 16:17:58 +00:00
242 | | }
243 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
2018-10-06 16:18:06 +00:00
error: the function has a cyclomatic complexity of 2
2018-12-09 16:17:58 +00:00
--> $DIR/cyclomatic_complexity.rs:246:1
|
2018-12-09 16:17:58 +00:00
246 | / fn barrrr() {
247 | | match 99 {
248 | | 0 => println!("hi"),
249 | | 1 => println!("bla"),
... |
2018-12-09 16:17:58 +00:00
252 | | }
253 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
2018-10-06 16:18:06 +00:00
error: the function has a cyclomatic complexity of 3
2018-12-09 16:17:58 +00:00
--> $DIR/cyclomatic_complexity.rs:256:1
|
2018-12-09 16:17:58 +00:00
256 | / fn barrrr2() {
257 | | match 99 {
258 | | 0 => println!("hi"),
259 | | 1 => println!("bla"),
... |
2018-12-09 16:17:58 +00:00
268 | | }
269 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
2018-10-06 16:18:06 +00:00
error: the function has a cyclomatic complexity of 2
2018-12-09 16:17:58 +00:00
--> $DIR/cyclomatic_complexity.rs:272:1
|
2018-12-09 16:17:58 +00:00
272 | / fn cake() {
273 | | if 4 == 5 {
274 | | println!("yea");
275 | | } else {
... |
2018-12-09 16:17:58 +00:00
278 | | println!("whee");
279 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
2018-10-06 16:18:06 +00:00
error: the function has a cyclomatic complexity of 4
2018-12-09 16:17:58 +00:00
--> $DIR/cyclomatic_complexity.rs:283:1
|
2018-12-09 16:17:58 +00:00
283 | / pub fn read_file(input_path: &str) -> String {
284 | | use std::fs::File;
285 | | use std::io::{Read, Write};
286 | | use std::path::Path;
2018-10-06 16:18:06 +00:00
... |
2018-12-09 16:17:58 +00:00
308 | | }
309 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 1
2018-12-09 16:17:58 +00:00
--> $DIR/cyclomatic_complexity.rs:314:1
|
314 | / fn void(void: Void) {
315 | | if true {
316 | | match void {
317 | | }
318 | | }
319 | | }
2018-10-06 16:18:06 +00:00
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 1
2018-12-09 16:17:58 +00:00
--> $DIR/cyclomatic_complexity.rs:328:1
|
328 | / fn try() -> Result<i32, &'static str> {
329 | | match 5 {
330 | | 5 => Ok(5),
331 | | _ => return Err("bla"),
332 | | }
333 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 1
2018-12-09 16:17:58 +00:00
--> $DIR/cyclomatic_complexity.rs:336:1
|
2018-12-09 16:17:58 +00:00
336 | / fn try_again() -> Result<i32, &'static str> {
337 | | let _ = try!(Ok(42));
338 | | let _ = try!(Ok(43));
339 | | let _ = try!(Ok(44));
... |
2018-12-09 16:17:58 +00:00
348 | | }
349 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 1
2018-12-09 16:17:58 +00:00
--> $DIR/cyclomatic_complexity.rs:352:1
|
2018-12-09 16:17:58 +00:00
352 | / fn early() -> Result<i32, &'static str> {
353 | | return Ok(5);
2018-10-06 16:18:06 +00:00
354 | | return Ok(5);
355 | | return Ok(5);
... |
2018-12-09 16:17:58 +00:00
361 | | return Ok(5);
362 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 8
2018-10-06 16:18:06 +00:00
--> $DIR/cyclomatic_complexity.rs:366:1
|
2018-10-06 16:18:06 +00:00
366 | / fn early_ret() -> i32 {
367 | | let a = if true { 42 } else { return 0; };
368 | | let a = if a < 99 { 42 } else { return 0; };
369 | | let a = if a < 99 { 42 } else { return 0; };
... |
2018-10-06 16:18:06 +00:00
382 | | }
383 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
2018-01-16 16:06:27 +00:00
error: aborting due to 20 previous errors