mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 23:20:39 +00:00
273 lines
6.7 KiB
Text
273 lines
6.7 KiB
Text
error: the function has a cyclomatic complexity of 28
|
|
--> $DIR/cyclomatic_complexity.rs:17:1
|
|
|
|
|
17 | / fn main() {
|
|
18 | | if true {
|
|
19 | | println!("a");
|
|
20 | | }
|
|
... |
|
|
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
|
|
--> $DIR/cyclomatic_complexity.rs:102:1
|
|
|
|
|
102 | / fn kaboom() {
|
|
103 | | let n = 0;
|
|
104 | | 'a: for i in 0..20 {
|
|
105 | | 'b: for j in i..20 {
|
|
... |
|
|
120 | | }
|
|
121 | | }
|
|
| |_^
|
|
|
|
|
= help: you could split it up into multiple smaller functions
|
|
|
|
error: the function has a cyclomatic complexity of 1
|
|
--> $DIR/cyclomatic_complexity.rs:148:1
|
|
|
|
|
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
|
|
--> $DIR/cyclomatic_complexity.rs:153:1
|
|
|
|
|
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
|
|
--> $DIR/cyclomatic_complexity.rs:158:1
|
|
|
|
|
158 | / fn baa() {
|
|
159 | | let x = || match 99 {
|
|
160 | | 0 => 0,
|
|
161 | | 1 => 1,
|
|
... |
|
|
172 | | }
|
|
173 | | }
|
|
| |_^
|
|
|
|
|
= help: you could split it up into multiple smaller functions
|
|
|
|
error: the function has a cyclomatic complexity of 2
|
|
--> $DIR/cyclomatic_complexity.rs:159:13
|
|
|
|
|
159 | let x = || match 99 {
|
|
| _____________^
|
|
160 | | 0 => 0,
|
|
161 | | 1 => 1,
|
|
162 | | 2 => 2,
|
|
... |
|
|
166 | | _ => 42,
|
|
167 | | };
|
|
| |_____^
|
|
|
|
|
= help: you could split it up into multiple smaller functions
|
|
|
|
error: the function has a cyclomatic complexity of 2
|
|
--> $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
|
|
--> $DIR/cyclomatic_complexity.rs:195:1
|
|
|
|
|
195 | / fn barr() {
|
|
196 | | match 99 {
|
|
197 | | 0 => println!("hi"),
|
|
198 | | 1 => println!("bla"),
|
|
... |
|
|
201 | | }
|
|
202 | | }
|
|
| |_^
|
|
|
|
|
= help: you could split it up into multiple smaller functions
|
|
|
|
error: the function has a cyclomatic complexity of 3
|
|
--> $DIR/cyclomatic_complexity.rs:205:1
|
|
|
|
|
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
|
|
|
|
error: the function has a cyclomatic complexity of 2
|
|
--> $DIR/cyclomatic_complexity.rs:221:1
|
|
|
|
|
221 | / fn barrr() {
|
|
222 | | match 99 {
|
|
223 | | 0 => println!("hi"),
|
|
224 | | 1 => panic!("bla"),
|
|
... |
|
|
227 | | }
|
|
228 | | }
|
|
| |_^
|
|
|
|
|
= help: you could split it up into multiple smaller functions
|
|
|
|
error: the function has a cyclomatic complexity of 3
|
|
--> $DIR/cyclomatic_complexity.rs:231:1
|
|
|
|
|
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
|
|
|
|
error: the function has a cyclomatic complexity of 2
|
|
--> $DIR/cyclomatic_complexity.rs:247:1
|
|
|
|
|
247 | / fn barrrr() {
|
|
248 | | match 99 {
|
|
249 | | 0 => println!("hi"),
|
|
250 | | 1 => println!("bla"),
|
|
... |
|
|
253 | | }
|
|
254 | | }
|
|
| |_^
|
|
|
|
|
= help: you could split it up into multiple smaller functions
|
|
|
|
error: the function has a cyclomatic complexity of 3
|
|
--> $DIR/cyclomatic_complexity.rs:257:1
|
|
|
|
|
257 | / fn barrrr2() {
|
|
258 | | match 99 {
|
|
259 | | 0 => println!("hi"),
|
|
260 | | 1 => println!("bla"),
|
|
... |
|
|
269 | | }
|
|
270 | | }
|
|
| |_^
|
|
|
|
|
= help: you could split it up into multiple smaller functions
|
|
|
|
error: the function has a cyclomatic complexity of 2
|
|
--> $DIR/cyclomatic_complexity.rs:273:1
|
|
|
|
|
273 | / fn cake() {
|
|
274 | | if 4 == 5 {
|
|
275 | | println!("yea");
|
|
276 | | } else {
|
|
... |
|
|
279 | | println!("whee");
|
|
280 | | }
|
|
| |_^
|
|
|
|
|
= help: you could split it up into multiple smaller functions
|
|
|
|
error: the function has a cyclomatic complexity of 4
|
|
--> $DIR/cyclomatic_complexity.rs:284:1
|
|
|
|
|
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
|
|
--> $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
|
|
--> $DIR/cyclomatic_complexity.rs:337:1
|
|
|
|
|
337 | / fn try_again() -> Result<i32, &'static str> {
|
|
338 | | let _ = try!(Ok(42));
|
|
339 | | let _ = try!(Ok(43));
|
|
340 | | let _ = try!(Ok(44));
|
|
... |
|
|
349 | | }
|
|
350 | | }
|
|
| |_^
|
|
|
|
|
= help: you could split it up into multiple smaller functions
|
|
|
|
error: the function has a cyclomatic complexity of 1
|
|
--> $DIR/cyclomatic_complexity.rs:353:1
|
|
|
|
|
353 | / fn early() -> Result<i32, &'static str> {
|
|
354 | | return Ok(5);
|
|
355 | | return Ok(5);
|
|
356 | | return Ok(5);
|
|
... |
|
|
362 | | return Ok(5);
|
|
363 | | }
|
|
| |_^
|
|
|
|
|
= help: you could split it up into multiple smaller functions
|
|
|
|
error: the function has a cyclomatic complexity of 8
|
|
--> $DIR/cyclomatic_complexity.rs:366:1
|
|
|
|
|
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; };
|
|
... |
|
|
382 | | }
|
|
383 | | }
|
|
| |_^
|
|
|
|
|
= help: you could split it up into multiple smaller functions
|
|
|
|
error: aborting due to 20 previous errors
|
|
|