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-10-06 16:18:06 +00:00
--> $DIR/cyclomatic_complexity.rs:17:1
|
2018-10-06 16:18:06 +00:00
17 | / fn main() {
18 | | if true {
19 | | println!("a");
20 | | }
... |
2018-10-06 16:18:06 +00:00
98 | | }
99 | | }
| |_^
|
= 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-10-06 16:18:06 +00:00
--> $DIR/cyclomatic_complexity.rs:102:1
|
2018-10-06 16:18:06 +00:00
102 | / fn kaboom() {
103 | | let n = 0;
104 | | 'a: for i in 0..20 {
105 | | 'b: for j in i..20 {
... |
2018-10-06 16:18:06 +00:00
120 | | }
121 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 1
2018-10-06 16:18:06 +00:00
--> $DIR/cyclomatic_complexity.rs:148:1
|
2018-10-06 16:18:06 +00:00
148 | / fn lots_of_short_circuits() -> bool {
149 | | true && false && true && false && true && false && true
150 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 1
2018-10-06 16:18:06 +00:00
--> $DIR/cyclomatic_complexity.rs:153:1
|
2018-10-06 16:18:06 +00:00
153 | / fn lots_of_short_circuits2() -> bool {
154 | | true || false || true || false || true || false || true
155 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 2
2018-10-06 16:18:06 +00:00
--> $DIR/cyclomatic_complexity.rs:158:1
|
2018-10-06 16:18:06 +00:00
158 | / fn baa() {
159 | | let x = || match 99 {
160 | | 0 => 0,
161 | | 1 => 1,
... |
2018-10-06 16:18:06 +00:00
172 | | }
173 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 2
2018-10-06 16:18:06 +00:00
--> $DIR/cyclomatic_complexity.rs:159:13
|
2018-10-06 16:18:06 +00:00
159 | let x = || match 99 {
| _____________^
2018-10-06 16:18:06 +00:00
160 | | 0 => 0,
161 | | 1 => 1,
162 | | 2 => 2,
... |
2018-10-06 16:18:06 +00:00
166 | | _ => 42,
167 | | };
| |_____^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 2
2018-10-06 16:18:06 +00:00
--> $DIR/cyclomatic_complexity.rs:176:1
|
176 | / fn bar() {
177 | | match 99 {
178 | | 0 => println!("hi"),
179 | | _ => println!("bye"),
180 | | }
181 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 2
2017-08-01 15:54:21 +00:00
--> $DIR/cyclomatic_complexity.rs:195:1
|
2018-10-06 16:18:06 +00:00
195 | / fn barr() {
196 | | match 99 {
197 | | 0 => println!("hi"),
198 | | 1 => println!("bla"),
... |
2018-10-06 16:18:06 +00:00
201 | | }
202 | | }
| |_^
|
= 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
--> $DIR/cyclomatic_complexity.rs:205:1
|
2018-10-06 16:18:06 +00:00
205 | / fn barr2() {
206 | | match 99 {
207 | | 0 => println!("hi"),
208 | | 1 => println!("bla"),
... |
217 | | }
218 | | }
| |_^
|
= 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
2017-08-01 15:54:21 +00:00
--> $DIR/cyclomatic_complexity.rs:221:1
|
2018-10-06 16:18:06 +00:00
221 | / fn barrr() {
222 | | match 99 {
223 | | 0 => println!("hi"),
224 | | 1 => panic!("bla"),
... |
2018-10-06 16:18:06 +00:00
227 | | }
228 | | }
| |_^
|
= 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
--> $DIR/cyclomatic_complexity.rs:231:1
|
2018-10-06 16:18:06 +00:00
231 | / fn barrr2() {
232 | | match 99 {
233 | | 0 => println!("hi"),
234 | | 1 => panic!("bla"),
... |
243 | | }
244 | | }
| |_^
|
= 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
2017-08-01 15:54:21 +00:00
--> $DIR/cyclomatic_complexity.rs:247:1
|
2018-10-06 16:18:06 +00:00
247 | / fn barrrr() {
248 | | match 99 {
249 | | 0 => println!("hi"),
250 | | 1 => println!("bla"),
... |
2018-10-06 16:18:06 +00:00
253 | | }
254 | | }
| |_^
|
= 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
--> $DIR/cyclomatic_complexity.rs:257:1
|
2018-10-06 16:18:06 +00:00
257 | / fn barrrr2() {
258 | | match 99 {
259 | | 0 => println!("hi"),
260 | | 1 => println!("bla"),
... |
2018-10-06 16:18:06 +00:00
269 | | }
270 | | }
| |_^
|
= 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
--> $DIR/cyclomatic_complexity.rs:273:1
|
2018-10-06 16:18:06 +00:00
273 | / fn cake() {
274 | | if 4 == 5 {
275 | | println!("yea");
276 | | } else {
... |
2018-10-06 16:18:06 +00:00
279 | | println!("whee");
280 | | }
| |_^
|
= 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
--> $DIR/cyclomatic_complexity.rs:284:1
|
2018-10-06 16:18:06 +00:00
284 | / pub fn read_file(input_path: &str) -> String {
285 | | use std::fs::File;
286 | | use std::io::{Read, Write};
287 | | use std::path::Path;
... |
309 | | }
310 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 1
2018-10-06 16:18:06 +00:00
--> $DIR/cyclomatic_complexity.rs:315:1
|
315 | / fn void(void: Void) {
316 | | if true {
317 | | match void {
318 | | }
319 | | }
320 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 1
--> $DIR/cyclomatic_complexity.rs:329:1
|
329 | / fn try() -> Result<i32, &'static str> {
330 | | match 5 {
331 | | 5 => Ok(5),
332 | | _ => return Err("bla"),
333 | | }
334 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 1
2018-10-06 16:18:06 +00:00
--> $DIR/cyclomatic_complexity.rs:337:1
|
2018-10-06 16:18:06 +00:00
337 | / fn try_again() -> Result<i32, &'static str> {
338 | | let _ = try!(Ok(42));
339 | | let _ = try!(Ok(43));
340 | | let _ = try!(Ok(44));
... |
2018-10-06 16:18:06 +00:00
349 | | }
350 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 1
2018-10-06 16:18:06 +00:00
--> $DIR/cyclomatic_complexity.rs:353:1
|
2018-10-06 16:18:06 +00:00
353 | / fn early() -> Result<i32, &'static str> {
354 | | return Ok(5);
355 | | return Ok(5);
356 | | return Ok(5);
... |
2018-10-06 16:18:06 +00:00
362 | | return Ok(5);
363 | | }
| |_^
|
= 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