2017-02-07 21:05:30 +01:00
|
|
|
error: the function has a cyclomatic complexity of 28
|
|
|
|
--> $DIR/cyclomatic_complexity.rs:7:1
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
7 | / fn main() {
|
2017-04-10 15:36:07 +02:00
|
|
|
8 | | if true {
|
|
|
|
9 | | println!("a");
|
|
|
|
10 | | }
|
|
|
|
... |
|
|
|
|
88 | | }
|
|
|
|
89 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
note: lint level defined here
|
|
|
|
--> $DIR/cyclomatic_complexity.rs:4:9
|
|
|
|
|
|
|
|
|
4 | #![deny(cyclomatic_complexity)]
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
= help: you could split it up into multiple smaller functions
|
|
|
|
|
|
|
|
error: the function has a cyclomatic complexity of 7
|
|
|
|
--> $DIR/cyclomatic_complexity.rs:92:1
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
92 | / fn kaboom() {
|
2017-04-10 15:36:07 +02:00
|
|
|
93 | | let n = 0;
|
|
|
|
94 | | 'a: for i in 0..20 {
|
|
|
|
95 | | 'b: for j in i..20 {
|
|
|
|
... |
|
|
|
|
110 | | }
|
|
|
|
111 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
= help: you could split it up into multiple smaller functions
|
|
|
|
|
|
|
|
error: the function has a cyclomatic complexity of 1
|
|
|
|
--> $DIR/cyclomatic_complexity.rs:138:1
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
138 | / fn lots_of_short_circuits() -> bool {
|
2017-02-07 21:05:30 +01:00
|
|
|
139 | | true && false && true && false && true && false && true
|
|
|
|
140 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
= help: you could split it up into multiple smaller functions
|
|
|
|
|
|
|
|
error: the function has a cyclomatic complexity of 1
|
|
|
|
--> $DIR/cyclomatic_complexity.rs:143:1
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
143 | / fn lots_of_short_circuits2() -> bool {
|
2017-02-07 21:05:30 +01:00
|
|
|
144 | | true || false || true || false || true || false || true
|
|
|
|
145 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
= help: you could split it up into multiple smaller functions
|
|
|
|
|
|
|
|
error: the function has a cyclomatic complexity of 2
|
|
|
|
--> $DIR/cyclomatic_complexity.rs:148:1
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
148 | / fn baa() {
|
2017-04-10 15:36:07 +02:00
|
|
|
149 | | let x = || match 99 {
|
|
|
|
150 | | 0 => 0,
|
|
|
|
151 | | 1 => 1,
|
|
|
|
... |
|
|
|
|
162 | | }
|
|
|
|
163 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
= help: you could split it up into multiple smaller functions
|
|
|
|
|
|
|
|
error: the function has a cyclomatic complexity of 2
|
|
|
|
--> $DIR/cyclomatic_complexity.rs:149:13
|
|
|
|
|
|
2017-02-08 14:58:07 +01:00
|
|
|
149 | let x = || match 99 {
|
2017-04-23 15:25:22 +02:00
|
|
|
| _____________^
|
2017-02-07 21:05:30 +01:00
|
|
|
150 | | 0 => 0,
|
|
|
|
151 | | 1 => 1,
|
|
|
|
152 | | 2 => 2,
|
2017-04-10 15:36:07 +02:00
|
|
|
... |
|
2017-02-07 21:05:30 +01:00
|
|
|
156 | | _ => 42,
|
|
|
|
157 | | };
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_____^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
= help: you could split it up into multiple smaller functions
|
|
|
|
|
|
|
|
error: the function has a cyclomatic complexity of 2
|
|
|
|
--> $DIR/cyclomatic_complexity.rs:166:1
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
166 | / fn bar() {
|
2017-02-07 21:05:30 +01:00
|
|
|
167 | | match 99 {
|
|
|
|
168 | | 0 => println!("hi"),
|
|
|
|
169 | | _ => println!("bye"),
|
|
|
|
170 | | }
|
|
|
|
171 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
= help: you could split it up into multiple smaller functions
|
|
|
|
|
|
|
|
error: the function has a cyclomatic complexity of 2
|
|
|
|
--> $DIR/cyclomatic_complexity.rs:185:1
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
185 | / fn barr() {
|
2017-02-07 21:05:30 +01:00
|
|
|
186 | | match 99 {
|
|
|
|
187 | | 0 => println!("hi"),
|
|
|
|
188 | | 1 => println!("bla"),
|
2017-04-10 15:36:07 +02:00
|
|
|
... |
|
2017-02-07 21:05:30 +01:00
|
|
|
191 | | }
|
|
|
|
192 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
= help: you could split it up into multiple smaller functions
|
|
|
|
|
|
|
|
error: the function has a cyclomatic complexity of 3
|
|
|
|
--> $DIR/cyclomatic_complexity.rs:195:1
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
195 | / fn barr2() {
|
2017-04-10 15:36:07 +02:00
|
|
|
196 | | match 99 {
|
|
|
|
197 | | 0 => println!("hi"),
|
|
|
|
198 | | 1 => println!("bla"),
|
|
|
|
... |
|
|
|
|
207 | | }
|
|
|
|
208 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
= help: you could split it up into multiple smaller functions
|
|
|
|
|
|
|
|
error: the function has a cyclomatic complexity of 2
|
|
|
|
--> $DIR/cyclomatic_complexity.rs:211:1
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
211 | / fn barrr() {
|
2017-02-07 21:05:30 +01:00
|
|
|
212 | | match 99 {
|
|
|
|
213 | | 0 => println!("hi"),
|
|
|
|
214 | | 1 => panic!("bla"),
|
2017-04-10 15:36:07 +02:00
|
|
|
... |
|
2017-02-07 21:05:30 +01:00
|
|
|
217 | | }
|
|
|
|
218 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
= help: you could split it up into multiple smaller functions
|
|
|
|
|
|
|
|
error: the function has a cyclomatic complexity of 3
|
|
|
|
--> $DIR/cyclomatic_complexity.rs:221:1
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
221 | / fn barrr2() {
|
2017-04-10 15:36:07 +02:00
|
|
|
222 | | match 99 {
|
|
|
|
223 | | 0 => println!("hi"),
|
|
|
|
224 | | 1 => panic!("bla"),
|
|
|
|
... |
|
|
|
|
233 | | }
|
|
|
|
234 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
= help: you could split it up into multiple smaller functions
|
|
|
|
|
|
|
|
error: the function has a cyclomatic complexity of 2
|
|
|
|
--> $DIR/cyclomatic_complexity.rs:237:1
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
237 | / fn barrrr() {
|
2017-02-07 21:05:30 +01:00
|
|
|
238 | | match 99 {
|
|
|
|
239 | | 0 => println!("hi"),
|
|
|
|
240 | | 1 => println!("bla"),
|
2017-04-10 15:36:07 +02:00
|
|
|
... |
|
2017-02-07 21:05:30 +01:00
|
|
|
243 | | }
|
|
|
|
244 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
= help: you could split it up into multiple smaller functions
|
|
|
|
|
|
|
|
error: the function has a cyclomatic complexity of 3
|
|
|
|
--> $DIR/cyclomatic_complexity.rs:247:1
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
247 | / fn barrrr2() {
|
2017-04-10 15:36:07 +02:00
|
|
|
248 | | match 99 {
|
|
|
|
249 | | 0 => println!("hi"),
|
|
|
|
250 | | 1 => println!("bla"),
|
|
|
|
... |
|
|
|
|
259 | | }
|
|
|
|
260 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
= help: you could split it up into multiple smaller functions
|
|
|
|
|
|
|
|
error: the function has a cyclomatic complexity of 2
|
|
|
|
--> $DIR/cyclomatic_complexity.rs:263:1
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
263 | / fn cake() {
|
2017-02-07 21:05:30 +01:00
|
|
|
264 | | if 4 == 5 {
|
|
|
|
265 | | println!("yea");
|
|
|
|
266 | | } else {
|
2017-04-10 15:36:07 +02:00
|
|
|
... |
|
2017-02-07 21:05:30 +01:00
|
|
|
269 | | println!("whee");
|
|
|
|
270 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
= help: you could split it up into multiple smaller functions
|
|
|
|
|
|
|
|
error: the function has a cyclomatic complexity of 4
|
|
|
|
--> $DIR/cyclomatic_complexity.rs:274:1
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
274 | / pub fn read_file(input_path: &str) -> String {
|
2017-04-10 15:36:07 +02:00
|
|
|
275 | | use std::fs::File;
|
|
|
|
276 | | use std::io::{Read, Write};
|
|
|
|
277 | | use std::path::Path;
|
|
|
|
... |
|
|
|
|
299 | | }
|
|
|
|
300 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
= help: you could split it up into multiple smaller functions
|
|
|
|
|
|
|
|
error: the function has a cyclomatic complexity of 1
|
|
|
|
--> $DIR/cyclomatic_complexity.rs:305:1
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
305 | / fn void(void: Void) {
|
2017-02-07 21:05:30 +01:00
|
|
|
306 | | if true {
|
|
|
|
307 | | match void {
|
|
|
|
308 | | }
|
|
|
|
309 | | }
|
|
|
|
310 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
= help: you could split it up into multiple smaller functions
|
|
|
|
|
|
|
|
error: the function has a cyclomatic complexity of 1
|
|
|
|
--> $DIR/cyclomatic_complexity.rs:319:1
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
319 | / fn try() -> Result<i32, &'static str> {
|
2017-02-07 21:05:30 +01:00
|
|
|
320 | | match 5 {
|
|
|
|
321 | | 5 => Ok(5),
|
|
|
|
322 | | _ => return Err("bla"),
|
|
|
|
323 | | }
|
|
|
|
324 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
= help: you could split it up into multiple smaller functions
|
|
|
|
|
|
|
|
error: the function has a cyclomatic complexity of 1
|
|
|
|
--> $DIR/cyclomatic_complexity.rs:327:1
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
327 | / fn try_again() -> Result<i32, &'static str> {
|
2017-04-10 15:36:07 +02:00
|
|
|
328 | | let _ = try!(Ok(42));
|
|
|
|
329 | | let _ = try!(Ok(43));
|
|
|
|
330 | | let _ = try!(Ok(44));
|
|
|
|
... |
|
|
|
|
339 | | }
|
|
|
|
340 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
= help: you could split it up into multiple smaller functions
|
|
|
|
|
|
|
|
error: the function has a cyclomatic complexity of 1
|
|
|
|
--> $DIR/cyclomatic_complexity.rs:343:1
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
343 | / fn early() -> Result<i32, &'static str> {
|
2017-04-10 15:36:07 +02:00
|
|
|
344 | | return Ok(5);
|
|
|
|
345 | | return Ok(5);
|
|
|
|
346 | | return Ok(5);
|
|
|
|
... |
|
|
|
|
352 | | return Ok(5);
|
|
|
|
353 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
= help: you could split it up into multiple smaller functions
|
|
|
|
|
|
|
|
error: the function has a cyclomatic complexity of 8
|
|
|
|
--> $DIR/cyclomatic_complexity.rs:356:1
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
356 | / fn early_ret() -> i32 {
|
2017-04-10 15:36:07 +02:00
|
|
|
357 | | let a = if true { 42 } else { return 0; };
|
|
|
|
358 | | let a = if a < 99 { 42 } else { return 0; };
|
|
|
|
359 | | let a = if a < 99 { 42 } else { return 0; };
|
|
|
|
... |
|
|
|
|
372 | | }
|
|
|
|
373 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
= help: you could split it up into multiple smaller functions
|
|
|
|
|
|
|
|
error: aborting due to 20 previous errors
|
|
|
|
|