]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/collapsible_if.stderr
Addition `manual_map` test for `unsafe` blocks
[rust.git] / tests / ui / collapsible_if.stderr
index e726a36282b5728eb1d631595ee7128ac18620d4..6749612388fe3726374e02b864cc2d3e37343935 100644 (file)
-error: this if statement can be collapsed
-  --> $DIR/collapsible_if.rs:8:5
-   |
- | /     if x == "hello" {
- | |         if y == "world" {
-10 | |             println!("Hello world!");
-11 | |         }
-12 | |     }
+error: this `if` statement can be collapsed
+  --> $DIR/collapsible_if.rs:9:5
+   |
+LL | /     if x == "hello" {
+LL | |         if y == "world" {
+LL | |             println!("Hello world!");
+LL | |         }
+LL | |     }
    | |_____^
    |
-   = note: `-D collapsible-if` implied by `-D warnings`
-help: try
+   = note: `-D clippy::collapsible-if` implied by `-D warnings`
+help: collapse nested if block
    |
-8  |     if x == "hello" && y == "world" {
-9  |     println!("Hello world!");
-10 | }
+LL ~     if x == "hello" && y == "world" {
+LL +         println!("Hello world!");
+LL +     }
    |
 
-error: this if statement can be collapsed
-  --> $DIR/collapsible_if.rs:14:5
-   |
-14 | /     if x == "hello" || x == "world" {
-15 | |         if y == "world" || y == "hello" {
-16 | |             println!("Hello world!");
-17 | |         }
-18 | |     }
+error: this `if` statement can be collapsed
+  --> $DIR/collapsible_if.rs:15:5
+   |
+LL | /     if x == "hello" || x == "world" {
+LL | |         if y == "world" || y == "hello" {
+LL | |             println!("Hello world!");
+LL | |         }
+LL | |     }
    | |_____^
    |
-help: try
+help: collapse nested if block
    |
-14 |     if (x == "hello" || x == "world") && (y == "world" || y == "hello") {
-15 |     println!("Hello world!");
-16 | }
+LL ~     if (x == "hello" || x == "world") && (y == "world" || y == "hello") {
+LL +         println!("Hello world!");
+LL +     }
    |
 
-error: this if statement can be collapsed
-  --> $DIR/collapsible_if.rs:20:5
-   |
-20 | /     if x == "hello" && x == "world" {
-21 | |         if y == "world" || y == "hello" {
-22 | |             println!("Hello world!");
-23 | |         }
-24 | |     }
+error: this `if` statement can be collapsed
+  --> $DIR/collapsible_if.rs:21:5
+   |
+LL | /     if x == "hello" && x == "world" {
+LL | |         if y == "world" || y == "hello" {
+LL | |             println!("Hello world!");
+LL | |         }
+LL | |     }
    | |_____^
    |
-help: try
+help: collapse nested if block
    |
-20 |     if x == "hello" && x == "world" && (y == "world" || y == "hello") {
-21 |     println!("Hello world!");
-22 | }
+LL ~     if x == "hello" && x == "world" && (y == "world" || y == "hello") {
+LL +         println!("Hello world!");
+LL +     }
    |
 
-error: this if statement can be collapsed
-  --> $DIR/collapsible_if.rs:26:5
-   |
-26 | /     if x == "hello" || x == "world" {
-27 | |         if y == "world" && y == "hello" {
-28 | |             println!("Hello world!");
-29 | |         }
-30 | |     }
+error: this `if` statement can be collapsed
+  --> $DIR/collapsible_if.rs:27:5
+   |
+LL | /     if x == "hello" || x == "world" {
+LL | |         if y == "world" && y == "hello" {
+LL | |             println!("Hello world!");
+LL | |         }
+LL | |     }
    | |_____^
    |
-help: try
+help: collapse nested if block
    |
-26 |     if (x == "hello" || x == "world") && y == "world" && y == "hello" {
-27 |     println!("Hello world!");
-28 | }
+LL ~     if (x == "hello" || x == "world") && y == "world" && y == "hello" {
+LL +         println!("Hello world!");
+LL +     }
    |
 
-error: this if statement can be collapsed
-  --> $DIR/collapsible_if.rs:32:5
-   |
-32 | /     if x == "hello" && x == "world" {
-33 | |         if y == "world" && y == "hello" {
-34 | |             println!("Hello world!");
-35 | |         }
-36 | |     }
+error: this `if` statement can be collapsed
+  --> $DIR/collapsible_if.rs:33:5
+   |
+LL | /     if x == "hello" && x == "world" {
+LL | |         if y == "world" && y == "hello" {
+LL | |             println!("Hello world!");
+LL | |         }
+LL | |     }
    | |_____^
    |
-help: try
+help: collapse nested if block
    |
-32 |     if x == "hello" && x == "world" && y == "world" && y == "hello" {
-33 |     println!("Hello world!");
-34 | }
+LL ~     if x == "hello" && x == "world" && y == "world" && y == "hello" {
+LL +         println!("Hello world!");
+LL +     }
    |
 
-error: this if statement can be collapsed
-  --> $DIR/collapsible_if.rs:38:5
-   |
-38 | /     if 42 == 1337 {
-39 | |         if 'a' != 'A' {
-40 | |             println!("world!")
-41 | |         }
-42 | |     }
+error: this `if` statement can be collapsed
+  --> $DIR/collapsible_if.rs:39:5
+   |
+LL | /     if 42 == 1337 {
+LL | |         if 'a' != 'A' {
+LL | |             println!("world!")
+LL | |         }
+LL | |     }
    | |_____^
    |
-help: try
+help: collapse nested if block
    |
-38 |     if 42 == 1337 && 'a' != 'A' {
-39 |     println!("world!")
-40 | }
+LL ~     if 42 == 1337 && 'a' != 'A' {
+LL +         println!("world!")
+LL +     }
    |
 
-error: this `else { if .. }` block can be collapsed
-  --> $DIR/collapsible_if.rs:47:12
-   |
-47 |       } else {
-   |  ____________^
-48 | |         if y == "world" {
-49 | |             println!("world!")
-50 | |         }
-51 | |     }
+error: this `if` statement can be collapsed
+  --> $DIR/collapsible_if.rs:95:5
+   |
+LL | /     if x == "hello" {
+LL | |         if y == "world" { // Collapsible
+LL | |             println!("Hello world!");
+LL | |         }
+LL | |     }
    | |_____^
    |
-help: try
+help: collapse nested if block
    |
-47 |     } else if y == "world" {
-48 |     println!("world!")
-49 | }
+LL ~     if x == "hello" && y == "world" { // Collapsible
+LL +         println!("Hello world!");
+LL +     }
    |
 
-error: this `else { if .. }` block can be collapsed
-  --> $DIR/collapsible_if.rs:55:12
-   |
-55 |       } else {
-   |  ____________^
-56 | |         if let Some(42) = Some(42) {
-57 | |             println!("world!")
-58 | |         }
-59 | |     }
-   | |_____^
-   |
-help: try
-   |
-55 |     } else if let Some(42) = Some(42) {
-56 |     println!("world!")
-57 | }
-   |
-
-error: this `else { if .. }` block can be collapsed
-  --> $DIR/collapsible_if.rs:63:12
-   |
-63 |       } else {
-   |  ____________^
-64 | |         if y == "world" {
-65 | |             println!("world")
-66 | |         }
-...  |
-69 | |         }
-70 | |     }
-   | |_____^
-   |
-help: try
-   |
-63 |     } else if y == "world" {
-64 |     println!("world")
-65 | }
-66 | else {
-67 |     println!("!")
-68 | }
+error: this `if` statement can be collapsed
+  --> $DIR/collapsible_if.rs:154:5
    |
+LL | /     if matches!(true, true) {
+LL | |         if matches!(true, true) {}
+LL | |     }
+   | |_____^ help: collapse nested if block: `if matches!(true, true) && matches!(true, true) {}`
 
-error: this `else { if .. }` block can be collapsed
-  --> $DIR/collapsible_if.rs:74:12
-   |
-74 |       } else {
-   |  ____________^
-75 | |         if let Some(42) = Some(42) {
-76 | |             println!("world")
-77 | |         }
-...  |
-80 | |         }
-81 | |     }
-   | |_____^
-   |
-help: try
-   |
-74 |     } else if let Some(42) = Some(42) {
-75 |     println!("world")
-76 | }
-77 | else {
-78 |     println!("!")
-79 | }
-   |
-
-error: this `else { if .. }` block can be collapsed
-  --> $DIR/collapsible_if.rs:85:12
-   |
-85 |       } else {
-   |  ____________^
-86 | |         if let Some(42) = Some(42) {
-87 | |             println!("world")
-88 | |         }
-...  |
-91 | |         }
-92 | |     }
-   | |_____^
-   |
-help: try
-   |
-85 |     } else if let Some(42) = Some(42) {
-86 |     println!("world")
-87 | }
-88 | else {
-89 |     println!("!")
-90 | }
-   |
-
-error: this `else { if .. }` block can be collapsed
-   --> $DIR/collapsible_if.rs:96:12
-    |
-96  |       } else {
-    |  ____________^
-97  | |         if x == "hello" {
-98  | |             println!("world")
-99  | |         }
-...   |
-102 | |         }
-103 | |     }
-    | |_____^
-    |
-help: try
-    |
-96  |     } else if x == "hello" {
-97  |     println!("world")
-98  | }
-99  | else {
-100 |     println!("!")
-101 | }
-    |
-
-error: this `else { if .. }` block can be collapsed
-   --> $DIR/collapsible_if.rs:107:12
-    |
-107 |       } else {
-    |  ____________^
-108 | |         if let Some(42) = Some(42) {
-109 | |             println!("world")
-110 | |         }
-...   |
-113 | |         }
-114 | |     }
-    | |_____^
-    |
-help: try
-    |
-107 |     } else if let Some(42) = Some(42) {
-108 |     println!("world")
-109 | }
-110 | else {
-111 |     println!("!")
-112 | }
-    |
+error: aborting due to 8 previous errors