]> 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 1b9195563e51c5bcbef20e9336700497b4a9a47a..6749612388fe3726374e02b864cc2d3e37343935 100644 (file)
@@ -1,5 +1,5 @@
-error: this if statement can be collapsed
-  --> $DIR/collapsible_if.rs:6:5
+error: this `if` statement can be collapsed
+  --> $DIR/collapsible_if.rs:9:5
    |
 LL | /     if x == "hello" {
 LL | |         if y == "world" {
@@ -9,15 +9,15 @@ LL | |     }
    | |_____^
    |
    = note: `-D clippy::collapsible-if` implied by `-D warnings`
-help: try
+help: collapse nested if block
    |
-LL |     if x == "hello" && y == "world" {
-LL |     println!("Hello world!");
-LL | }
+LL ~     if x == "hello" && y == "world" {
+LL +         println!("Hello world!");
+LL +     }
    |
 
-error: this if statement can be collapsed
-  --> $DIR/collapsible_if.rs:12:5
+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" {
@@ -25,15 +25,16 @@ LL | |             println!("Hello world!");
 LL | |         }
 LL | |     }
    | |_____^
-help: try
    |
-LL |     if (x == "hello" || x == "world") && (y == "world" || y == "hello") {
-LL |     println!("Hello world!");
-LL | }
+help: collapse nested if block
+   |
+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:18:5
+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" {
@@ -41,15 +42,16 @@ LL | |             println!("Hello world!");
 LL | |         }
 LL | |     }
    | |_____^
-help: try
    |
-LL |     if x == "hello" && x == "world" && (y == "world" || y == "hello") {
-LL |     println!("Hello world!");
-LL | }
+help: collapse nested if block
+   |
+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:24:5
+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" {
@@ -57,15 +59,16 @@ LL | |             println!("Hello world!");
 LL | |         }
 LL | |     }
    | |_____^
-help: try
    |
-LL |     if (x == "hello" || x == "world") && y == "world" && y == "hello" {
-LL |     println!("Hello world!");
-LL | }
+help: collapse nested if block
+   |
+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:30:5
+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" {
@@ -73,15 +76,16 @@ LL | |             println!("Hello world!");
 LL | |         }
 LL | |     }
    | |_____^
-help: try
    |
-LL |     if x == "hello" && x == "world" && y == "world" && y == "hello" {
-LL |     println!("Hello world!");
-LL | }
+help: collapse nested if block
+   |
+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:36:5
+error: this `if` statement can be collapsed
+  --> $DIR/collapsible_if.rs:39:5
    |
 LL | /     if 42 == 1337 {
 LL | |         if 'a' != 'A' {
@@ -89,172 +93,38 @@ LL | |             println!("world!")
 LL | |         }
 LL | |     }
    | |_____^
-help: try
-   |
-LL |     if 42 == 1337 && 'a' != 'A' {
-LL |     println!("world!")
-LL | }
-   |
-
-error: this `else { if .. }` block can be collapsed
-  --> $DIR/collapsible_if.rs:45:12
-   |
-LL |       } else {
-   |  ____________^
-LL | |         if y == "world" {
-LL | |             println!("world!")
-LL | |         }
-LL | |     }
-   | |_____^
-help: try
-   |
-LL |     } else if y == "world" {
-LL |     println!("world!")
-LL | }
-   |
-
-error: this `else { if .. }` block can be collapsed
-  --> $DIR/collapsible_if.rs:53:12
-   |
-LL |       } else {
-   |  ____________^
-LL | |         if let Some(42) = Some(42) {
-LL | |             println!("world!")
-LL | |         }
-LL | |     }
-   | |_____^
-help: try
-   |
-LL |     } else if let Some(42) = Some(42) {
-LL |     println!("world!")
-LL | }
-   |
-
-error: this `else { if .. }` block can be collapsed
-  --> $DIR/collapsible_if.rs:61:12
    |
-LL |       } else {
-   |  ____________^
-LL | |         if y == "world" {
-LL | |             println!("world")
-LL | |         }
-...  |
-LL | |         }
-LL | |     }
-   | |_____^
-help: try
+help: collapse nested if block
    |
-LL |     } else if y == "world" {
-LL |     println!("world")
-LL | }
-LL | else {
-LL |     println!("!")
-LL | }
+LL ~     if 42 == 1337 && 'a' != 'A' {
+LL +         println!("world!")
+LL +     }
    |
 
-error: this `else { if .. }` block can be collapsed
-  --> $DIR/collapsible_if.rs:72:12
+error: this `if` statement can be collapsed
+  --> $DIR/collapsible_if.rs:95:5
    |
-LL |       } else {
-   |  ____________^
-LL | |         if let Some(42) = Some(42) {
-LL | |             println!("world")
-LL | |         }
-...  |
-LL | |         }
-LL | |     }
-   | |_____^
-help: try
-   |
-LL |     } else if let Some(42) = Some(42) {
-LL |     println!("world")
-LL | }
-LL | else {
-LL |     println!("!")
-LL | }
-   |
-
-error: this `else { if .. }` block can be collapsed
-  --> $DIR/collapsible_if.rs:83:12
-   |
-LL |       } else {
-   |  ____________^
-LL | |         if let Some(42) = Some(42) {
-LL | |             println!("world")
-LL | |         }
-...  |
-LL | |         }
-LL | |     }
-   | |_____^
-help: try
-   |
-LL |     } else if let Some(42) = Some(42) {
-LL |     println!("world")
-LL | }
-LL | else {
-LL |     println!("!")
-LL | }
-   |
-
-error: this `else { if .. }` block can be collapsed
-  --> $DIR/collapsible_if.rs:94:12
-   |
-LL |       } else {
-   |  ____________^
-LL | |         if x == "hello" {
-LL | |             println!("world")
-LL | |         }
-...  |
+LL | /     if x == "hello" {
+LL | |         if y == "world" { // Collapsible
+LL | |             println!("Hello world!");
 LL | |         }
 LL | |     }
    | |_____^
-help: try
-   |
-LL |     } else if x == "hello" {
-LL |     println!("world")
-LL | }
-LL | else {
-LL |     println!("!")
-LL | }
-   |
-
-error: this `else { if .. }` block can be collapsed
-  --> $DIR/collapsible_if.rs:105:12
    |
-LL |       } else {
-   |  ____________^
-LL | |         if let Some(42) = Some(42) {
-LL | |             println!("world")
-LL | |         }
-...  |
-LL | |         }
-LL | |     }
-   | |_____^
-help: try
+help: collapse nested if block
    |
-LL |     } else if let Some(42) = Some(42) {
-LL |     println!("world")
-LL | }
-LL | else {
-LL |     println!("!")
-LL | }
+LL ~     if x == "hello" && y == "world" { // Collapsible
+LL +         println!("Hello world!");
+LL +     }
    |
 
-error: this if statement can be collapsed
-  --> $DIR/collapsible_if.rs:164:5
+error: this `if` statement can be collapsed
+  --> $DIR/collapsible_if.rs:154:5
    |
-LL | /     if x == "hello" {
-LL | |         if y == "world" { // Collapsible
-LL | |             println!("Hello world!");
-LL | |         }
+LL | /     if matches!(true, true) {
+LL | |         if matches!(true, true) {}
 LL | |     }
-   | |_____^
-help: try
-   |
-LL |     if x == "hello" && y == "world" { // Collapsible
-LL |     println!("Hello world!");
-LL | }
-   |
+   | |_____^ help: collapse nested if block: `if matches!(true, true) && matches!(true, true) {}`
 
-error: aborting due to 14 previous errors
+error: aborting due to 8 previous errors