]> 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 697dec336fab39c71bd8392e76a2dfce96d48ac9..6749612388fe3726374e02b864cc2d3e37343935 100644 (file)
-error: this if statement can be collapsed
-  --> $DIR/collapsible_if.rs:16:5
-   |
-16 | /     if x == "hello" {
-17 | |         if y == "world" {
-18 | |             println!("Hello world!");
-19 | |         }
-20 | |     }
+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 clippy::collapsible-if` implied by `-D warnings`
-help: try
+help: collapse nested if block
    |
-16 |     if x == "hello" && y == "world" {
-17 |     println!("Hello world!");
-18 | }
+LL ~     if x == "hello" && y == "world" {
+LL +         println!("Hello world!");
+LL +     }
    |
 
-error: this if statement can be collapsed
-  --> $DIR/collapsible_if.rs:22:5
-   |
-22 | /     if x == "hello" || x == "world" {
-23 | |         if y == "world" || y == "hello" {
-24 | |             println!("Hello world!");
-25 | |         }
-26 | |     }
+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
    |
-22 |     if (x == "hello" || x == "world") && (y == "world" || y == "hello") {
-23 |     println!("Hello world!");
-24 | }
+help: collapse nested if block
    |
-
-error: this if statement can be collapsed
-  --> $DIR/collapsible_if.rs:28:5
-   |
-28 | /     if x == "hello" && x == "world" {
-29 | |         if y == "world" || y == "hello" {
-30 | |             println!("Hello world!");
-31 | |         }
-32 | |     }
-   | |_____^
-help: try
-   |
-28 |     if x == "hello" && x == "world" && (y == "world" || y == "hello") {
-29 |     println!("Hello world!");
-30 | }
+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:34:5
-   |
-34 | /     if x == "hello" || x == "world" {
-35 | |         if y == "world" && y == "hello" {
-36 | |             println!("Hello world!");
-37 | |         }
-38 | |     }
+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
    |
-34 |     if (x == "hello" || x == "world") && y == "world" && y == "hello" {
-35 |     println!("Hello world!");
-36 | }
+help: collapse nested if block
    |
-
-error: this if statement can be collapsed
-  --> $DIR/collapsible_if.rs:40:5
-   |
-40 | /     if x == "hello" && x == "world" {
-41 | |         if y == "world" && y == "hello" {
-42 | |             println!("Hello world!");
-43 | |         }
-44 | |     }
-   | |_____^
-help: try
-   |
-40 |     if x == "hello" && x == "world" && y == "world" && y == "hello" {
-41 |     println!("Hello world!");
-42 | }
+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:46:5
-   |
-46 | /     if 42 == 1337 {
-47 | |         if 'a' != 'A' {
-48 | |             println!("world!")
-49 | |         }
-50 | |     }
+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
-   |
-46 |     if 42 == 1337 && 'a' != 'A' {
-47 |     println!("world!")
-48 | }
    |
-
-error: this `else { if .. }` block can be collapsed
-  --> $DIR/collapsible_if.rs:55:12
-   |
-55 |       } else {
-   |  ____________^
-56 | |         if y == "world" {
-57 | |             println!("world!")
-58 | |         }
-59 | |     }
-   | |_____^
-help: try
+help: collapse nested if block
    |
-55 |     } else if y == "world" {
-56 |     println!("world!")
-57 | }
+LL ~     if (x == "hello" || x == "world") && y == "world" && y == "hello" {
+LL +         println!("Hello world!");
+LL +     }
    |
 
-error: this `else { if .. }` block can be collapsed
-  --> $DIR/collapsible_if.rs:63:12
-   |
-63 |       } else {
-   |  ____________^
-64 | |         if let Some(42) = Some(42) {
-65 | |             println!("world!")
-66 | |         }
-67 | |     }
+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
    |
-63 |     } else if let Some(42) = Some(42) {
-64 |     println!("world!")
-65 | }
+help: collapse nested if block
    |
-
-error: this `else { if .. }` block can be collapsed
-  --> $DIR/collapsible_if.rs:71:12
+LL ~     if x == "hello" && x == "world" && y == "world" && y == "hello" {
+LL +         println!("Hello world!");
+LL +     }
    |
-71 |       } else {
-   |  ____________^
-72 | |         if y == "world" {
-73 | |             println!("world")
-74 | |         }
-...  |
-77 | |         }
-78 | |     }
+
+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
    |
-71 |     } else if y == "world" {
-72 |     println!("world")
-73 | }
-74 | else {
-75 |     println!("!")
-76 | }
+help: collapse nested if block
    |
-
-error: this `else { if .. }` block can be collapsed
-  --> $DIR/collapsible_if.rs:82:12
+LL ~     if 42 == 1337 && 'a' != 'A' {
+LL +         println!("world!")
+LL +     }
    |
-82 |       } else {
-   |  ____________^
-83 | |         if let Some(42) = Some(42) {
-84 | |             println!("world")
-85 | |         }
-...  |
-88 | |         }
-89 | |     }
+
+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
    |
-82 |     } else if let Some(42) = Some(42) {
-83 |     println!("world")
-84 | }
-85 | else {
-86 |     println!("!")
-87 | }
+help: collapse nested if block
+   |
+LL ~     if x == "hello" && y == "world" { // Collapsible
+LL +         println!("Hello world!");
+LL +     }
    |
 
-error: this `else { if .. }` block can be collapsed
-   --> $DIR/collapsible_if.rs:93:12
-    |
-93  |       } else {
-    |  ____________^
-94  | |         if let Some(42) = Some(42) {
-95  | |             println!("world")
-96  | |         }
-...   |
-99  | |         }
-100 | |     }
-    | |_____^
-help: try
-    |
-93  |     } else if let Some(42) = Some(42) {
-94  |     println!("world")
-95  | }
-96  | else {
-97  |     println!("!")
-98  | }
-    |
-
-error: this `else { if .. }` block can be collapsed
-   --> $DIR/collapsible_if.rs:104:12
-    |
-104 |       } else {
-    |  ____________^
-105 | |         if x == "hello" {
-106 | |             println!("world")
-107 | |         }
-...   |
-110 | |         }
-111 | |     }
-    | |_____^
-help: try
-    |
-104 |     } else if x == "hello" {
-105 |     println!("world")
-106 | }
-107 | else {
-108 |     println!("!")
-109 | }
-    |
-
-error: this `else { if .. }` block can be collapsed
-   --> $DIR/collapsible_if.rs:115:12
-    |
-115 |       } else {
-    |  ____________^
-116 | |         if let Some(42) = Some(42) {
-117 | |             println!("world")
-118 | |         }
-...   |
-121 | |         }
-122 | |     }
-    | |_____^
-help: try
-    |
-115 |     } else if let Some(42) = Some(42) {
-116 |     println!("world")
-117 | }
-118 | else {
-119 |     println!("!")
-120 | }
-    |
-
-error: this if statement can be collapsed
-   --> $DIR/collapsible_if.rs:174:5
-    |
-174 | /     if x == "hello" {
-175 | |         if y == "world" { // Collapsible
-176 | |             println!("Hello world!");
-177 | |         }
-178 | |     }
-    | |_____^
-help: try
-    |
-174 |     if x == "hello" && y == "world" { // Collapsible
-175 |     println!("Hello world!");
-176 | }
-    |
+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: aborting due to 14 previous errors
+error: aborting due to 8 previous errors