]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/cyclomatic_complexity.stderr
Auto merge of #3603 - xfix:random-state-lint, r=phansch
[rust.git] / tests / ui / cyclomatic_complexity.stderr
index 45f258f95604b40fea8668b5bd46e56626c3d7ee..f8e3a54debda375e55b5c50a6d90ae804c18ded1 100644 (file)
 error: the function has a cyclomatic complexity of 28
-  --> $DIR/cyclomatic_complexity.rs:7:1
+  --> $DIR/cyclomatic_complexity.rs:15:1
    |
-7  | fn main() { //~ERROR the function has a cyclomatic complexity of 28
-   | ^
+LL | / fn main() {
+LL | |     if true {
+LL | |         println!("a");
+LL | |     }
+...  |
+LL | |     }
+LL | | }
+   | |_^
    |
-note: lint level defined here
-  --> $DIR/cyclomatic_complexity.rs:4:9
-   |
-4  | #![deny(cyclomatic_complexity)]
-   |         ^^^^^^^^^^^^^^^^^^^^^
+   = 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:92:1
-    |
-92  | fn kaboom() {  //~ ERROR: the function has a cyclomatic complexity of 7
-    | ^
-    |
-    = help: you could split it up into multiple smaller functions
+  --> $DIR/cyclomatic_complexity.rs:100:1
+   |
+LL | / fn kaboom() {
+LL | |     let n = 0;
+LL | |     'a: for i in 0..20 {
+LL | |         'b: for j in i..20 {
+...  |
+LL | |     }
+LL | | }
+   | |_^
+   |
+   = 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
-    |
-138 |   fn lots_of_short_circuits() -> bool { //~ ERROR: the function has a cyclomatic complexity of 1
-    |  _^ starting here...
-139 | |     true && false && true && false && true && false && true
-140 | | }
-    | |_^ ...ending here
-    |
-    = help: you could split it up into multiple smaller functions
+  --> $DIR/cyclomatic_complexity.rs:146:1
+   |
+LL | / fn lots_of_short_circuits() -> bool {
+LL | |     true && false && true && false && true && false && true
+LL | | }
+   | |_^
+   |
+   = 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
-    |
-143 |   fn lots_of_short_circuits2() -> bool { //~ ERROR: the function has a cyclomatic complexity of 1
-    |  _^ starting here...
-144 | |     true || false || true || false || true || false || true
-145 | | }
-    | |_^ ...ending here
-    |
-    = help: you could split it up into multiple smaller functions
+  --> $DIR/cyclomatic_complexity.rs:151:1
+   |
+LL | / fn lots_of_short_circuits2() -> bool {
+LL | |     true || false || true || false || true || false || true
+LL | | }
+   | |_^
+   |
+   = 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
-    |
-148 | fn baa() { //~ ERROR: the function has a cyclomatic complexity of 2
-    | ^
-    |
-    = help: you could split it up into multiple smaller functions
+  --> $DIR/cyclomatic_complexity.rs:156:1
+   |
+LL | / fn baa() {
+LL | |     let x = || match 99 {
+LL | |         0 => 0,
+LL | |         1 => 1,
+...  |
+LL | |     }
+LL | | }
+   | |_^
+   |
+   = 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
-    |
-149 |       let x = || match 99 { //~ ERROR: the function has a cyclomatic complexity of 2
-    |  _____________^ starting here...
-150 | |         0 => 0,
-151 | |         1 => 1,
-152 | |         2 => 2,
-153 | |         4 => 4,
-154 | |         6 => 6,
-155 | |         9 => 9,
-156 | |         _ => 42,
-157 | |     };
-    | |_____^ ...ending here
-    |
-    = help: you could split it up into multiple smaller functions
+  --> $DIR/cyclomatic_complexity.rs:157:13
+   |
+LL |       let x = || match 99 {
+   |  _____________^
+LL | |         0 => 0,
+LL | |         1 => 1,
+LL | |         2 => 2,
+...  |
+LL | |         _ => 42,
+LL | |     };
+   | |_____^
+   |
+   = 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
-    |
-166 |   fn bar() { //~ ERROR: the function has a cyclomatic complexity of 2
-    |  _^ starting here...
-167 | |     match 99 {
-168 | |         0 => println!("hi"),
-169 | |         _ => println!("bye"),
-170 | |     }
-171 | | }
-    | |_^ ...ending here
-    |
-    = help: you could split it up into multiple smaller functions
+  --> $DIR/cyclomatic_complexity.rs:174:1
+   |
+LL | / fn bar() {
+LL | |     match 99 {
+LL | |         0 => println!("hi"),
+LL | |         _ => println!("bye"),
+LL | |     }
+LL | | }
+   | |_^
+   |
+   = 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
-    |
-185 |   fn barr() { //~ ERROR: the function has a cyclomatic complexity of 2
-    |  _^ starting here...
-186 | |     match 99 {
-187 | |         0 => println!("hi"),
-188 | |         1 => println!("bla"),
-189 | |         2 | 3 => println!("blub"),
-190 | |         _ => println!("bye"),
-191 | |     }
-192 | | }
-    | |_^ ...ending here
-    |
-    = help: you could split it up into multiple smaller functions
+  --> $DIR/cyclomatic_complexity.rs:193:1
+   |
+LL | / fn barr() {
+LL | |     match 99 {
+LL | |         0 => println!("hi"),
+LL | |         1 => println!("bla"),
+...  |
+LL | |     }
+LL | | }
+   | |_^
+   |
+   = 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
-    |
-195 | fn barr2() { //~ ERROR: the function has a cyclomatic complexity of 3
-    | ^
-    |
-    = help: you could split it up into multiple smaller functions
+  --> $DIR/cyclomatic_complexity.rs:203:1
+   |
+LL | / fn barr2() {
+LL | |     match 99 {
+LL | |         0 => println!("hi"),
+LL | |         1 => println!("bla"),
+...  |
+LL | |     }
+LL | | }
+   | |_^
+   |
+   = 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
-    |
-211 |   fn barrr() { //~ ERROR: the function has a cyclomatic complexity of 2
-    |  _^ starting here...
-212 | |     match 99 {
-213 | |         0 => println!("hi"),
-214 | |         1 => panic!("bla"),
-215 | |         2 | 3 => println!("blub"),
-216 | |         _ => println!("bye"),
-217 | |     }
-218 | | }
-    | |_^ ...ending here
-    |
-    = help: you could split it up into multiple smaller functions
+  --> $DIR/cyclomatic_complexity.rs:219:1
+   |
+LL | / fn barrr() {
+LL | |     match 99 {
+LL | |         0 => println!("hi"),
+LL | |         1 => panic!("bla"),
+...  |
+LL | |     }
+LL | | }
+   | |_^
+   |
+   = 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
-    |
-221 | fn barrr2() { //~ ERROR: the function has a cyclomatic complexity of 3
-    | ^
-    |
-    = help: you could split it up into multiple smaller functions
+  --> $DIR/cyclomatic_complexity.rs:229:1
+   |
+LL | / fn barrr2() {
+LL | |     match 99 {
+LL | |         0 => println!("hi"),
+LL | |         1 => panic!("bla"),
+...  |
+LL | |     }
+LL | | }
+   | |_^
+   |
+   = 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
-    |
-237 |   fn barrrr() { //~ ERROR: the function has a cyclomatic complexity of 2
-    |  _^ starting here...
-238 | |     match 99 {
-239 | |         0 => println!("hi"),
-240 | |         1 => println!("bla"),
-241 | |         2 | 3 => panic!("blub"),
-242 | |         _ => println!("bye"),
-243 | |     }
-244 | | }
-    | |_^ ...ending here
-    |
-    = help: you could split it up into multiple smaller functions
+  --> $DIR/cyclomatic_complexity.rs:245:1
+   |
+LL | / fn barrrr() {
+LL | |     match 99 {
+LL | |         0 => println!("hi"),
+LL | |         1 => println!("bla"),
+...  |
+LL | |     }
+LL | | }
+   | |_^
+   |
+   = 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
-    |
-247 | fn barrrr2() { //~ ERROR: the function has a cyclomatic complexity of 3
-    | ^
-    |
-    = help: you could split it up into multiple smaller functions
+  --> $DIR/cyclomatic_complexity.rs:255:1
+   |
+LL | / fn barrrr2() {
+LL | |     match 99 {
+LL | |         0 => println!("hi"),
+LL | |         1 => println!("bla"),
+...  |
+LL | |     }
+LL | | }
+   | |_^
+   |
+   = 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
-    |
-263 |   fn cake() { //~ ERROR: the function has a cyclomatic complexity of 2
-    |  _^ starting here...
-264 | |     if 4 == 5 {
-265 | |         println!("yea");
-266 | |     } else {
-267 | |         panic!("meh");
-268 | |     }
-269 | |     println!("whee");
-270 | | }
-    | |_^ ...ending here
-    |
-    = help: you could split it up into multiple smaller functions
+  --> $DIR/cyclomatic_complexity.rs:271:1
+   |
+LL | / fn cake() {
+LL | |     if 4 == 5 {
+LL | |         println!("yea");
+LL | |     } else {
+...  |
+LL | |     println!("whee");
+LL | | }
+   | |_^
+   |
+   = 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
-    |
-274 | pub fn read_file(input_path: &str) -> String { //~ ERROR: the function has a cyclomatic complexity of 4
-    | ^
-    |
-    = help: you could split it up into multiple smaller functions
+  --> $DIR/cyclomatic_complexity.rs:281:1
+   |
+LL | / pub fn read_file(input_path: &str) -> String {
+LL | |     use std::fs::File;
+LL | |     use std::io::{Read, Write};
+LL | |     use std::path::Path;
+...  |
+LL | |     }
+LL | | }
+   | |_^
+   |
+   = 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
-    |
-305 |   fn void(void: Void) { //~ ERROR: the function has a cyclomatic complexity of 1
-    |  _^ starting here...
-306 | |     if true {
-307 | |         match void {
-308 | |         }
-309 | |     }
-310 | | }
-    | |_^ ...ending here
-    |
-    = help: you could split it up into multiple smaller functions
+  --> $DIR/cyclomatic_complexity.rs:312:1
+   |
+LL | / fn void(void: Void) {
+LL | |     if true {
+LL | |         match void {}
+LL | |     }
+LL | | }
+   | |_^
+   |
+   = 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
-    |
-319 |   fn try() -> Result<i32, &'static str> { //~ ERROR: cyclomatic complexity of 1
-    |  _^ starting here...
-320 | |     match 5 {
-321 | |         5 => Ok(5),
-322 | |         _ => return Err("bla"),
-323 | |     }
-324 | | }
-    | |_^ ...ending here
-    |
-    = help: you could split it up into multiple smaller functions
+  --> $DIR/cyclomatic_complexity.rs:325:1
+   |
+LL | / fn try() -> Result<i32, &'static str> {
+LL | |     match 5 {
+LL | |         5 => Ok(5),
+LL | |         _ => return Err("bla"),
+LL | |     }
+LL | | }
+   | |_^
+   |
+   = 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
-    |
-327 | fn try_again() -> Result<i32, &'static str> { //~ ERROR: cyclomatic complexity of 1
-    | ^
-    |
-    = help: you could split it up into multiple smaller functions
+  --> $DIR/cyclomatic_complexity.rs:333:1
+   |
+LL | / fn try_again() -> Result<i32, &'static str> {
+LL | |     let _ = try!(Ok(42));
+LL | |     let _ = try!(Ok(43));
+LL | |     let _ = try!(Ok(44));
+...  |
+LL | |     }
+LL | | }
+   | |_^
+   |
+   = 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
-    |
-343 | fn early() -> Result<i32, &'static str> { //~ ERROR: cyclomatic complexity of 1
-    | ^
-    |
-    = help: you could split it up into multiple smaller functions
+  --> $DIR/cyclomatic_complexity.rs:349:1
+   |
+LL | / fn early() -> Result<i32, &'static str> {
+LL | |     return Ok(5);
+LL | |     return Ok(5);
+LL | |     return Ok(5);
+...  |
+LL | |     return Ok(5);
+LL | | }
+   | |_^
+   |
+   = 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
-    |
-356 | fn early_ret() -> i32 { //~ ERROR: cyclomatic complexity of 8
-    | ^
-    |
-    = help: you could split it up into multiple smaller functions
+  --> $DIR/cyclomatic_complexity.rs:363:1
+   |
+LL | / fn early_ret() -> i32 {
+LL | |     let a = if true { 42 } else { return 0; };
+LL | |     let a = if a < 99 { 42 } else { return 0; };
+LL | |     let a = if a < 99 { 42 } else { return 0; };
+...  |
+LL | |     }
+LL | | }
+   | |_^
+   |
+   = help: you could split it up into multiple smaller functions
 
 error: aborting due to 20 previous errors