2020-01-07 00:06:23 -06:00
|
|
|
error: this `else { if .. }` block can be collapsed
|
2024-08-24 12:43:34 -05:00
|
|
|
--> tests/ui/collapsible_else_if.rs:11:12
|
2020-01-07 00:06:23 -06:00
|
|
|
|
|
|
|
|
LL | } else {
|
|
|
|
| ____________^
|
|
|
|
LL | | if y == "world" {
|
|
|
|
LL | | println!("world!")
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
|
|
|
|
|
2021-01-15 03:56:44 -06:00
|
|
|
= note: `-D clippy::collapsible-else-if` implied by `-D warnings`
|
2023-08-01 07:02:21 -05:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::collapsible_else_if)]`
|
2020-07-14 07:59:59 -05:00
|
|
|
help: collapse nested if block
|
2020-01-07 00:06:23 -06:00
|
|
|
|
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~ } else if y == "world" {
|
|
|
|
LL + println!("world!")
|
|
|
|
LL + }
|
2020-01-07 00:06:23 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
2024-08-24 12:43:34 -05:00
|
|
|
--> tests/ui/collapsible_else_if.rs:19:12
|
2020-01-07 00:06:23 -06:00
|
|
|
|
|
|
|
|
LL | } else {
|
|
|
|
| ____________^
|
|
|
|
LL | | if let Some(42) = Some(42) {
|
|
|
|
LL | | println!("world!")
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
|
|
|
|
|
2020-07-14 07:59:59 -05:00
|
|
|
help: collapse nested if block
|
2020-01-07 00:06:23 -06:00
|
|
|
|
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~ } else if let Some(42) = Some(42) {
|
|
|
|
LL + println!("world!")
|
|
|
|
LL + }
|
2020-01-07 00:06:23 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
2024-08-24 12:43:34 -05:00
|
|
|
--> tests/ui/collapsible_else_if.rs:27:12
|
2020-01-07 00:06:23 -06:00
|
|
|
|
|
|
|
|
LL | } else {
|
|
|
|
| ____________^
|
|
|
|
LL | | if y == "world" {
|
|
|
|
LL | | println!("world")
|
|
|
|
LL | | }
|
|
|
|
... |
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
|
|
|
|
|
2020-07-14 07:59:59 -05:00
|
|
|
help: collapse nested if block
|
2020-01-07 00:06:23 -06:00
|
|
|
|
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~ } else if y == "world" {
|
|
|
|
LL + println!("world")
|
|
|
|
LL + }
|
|
|
|
LL + else {
|
|
|
|
LL + println!("!")
|
|
|
|
LL + }
|
2020-01-07 00:06:23 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
2024-08-24 12:43:34 -05:00
|
|
|
--> tests/ui/collapsible_else_if.rs:38:12
|
2020-01-07 00:06:23 -06:00
|
|
|
|
|
|
|
|
LL | } else {
|
|
|
|
| ____________^
|
|
|
|
LL | | if let Some(42) = Some(42) {
|
|
|
|
LL | | println!("world")
|
|
|
|
LL | | }
|
|
|
|
... |
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
|
|
|
|
|
2020-07-14 07:59:59 -05:00
|
|
|
help: collapse nested if block
|
2020-01-07 00:06:23 -06:00
|
|
|
|
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~ } else if let Some(42) = Some(42) {
|
|
|
|
LL + println!("world")
|
|
|
|
LL + }
|
|
|
|
LL + else {
|
|
|
|
LL + println!("!")
|
|
|
|
LL + }
|
2020-01-07 00:06:23 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
2024-08-24 12:43:34 -05:00
|
|
|
--> tests/ui/collapsible_else_if.rs:49:12
|
2020-01-07 00:06:23 -06:00
|
|
|
|
|
|
|
|
LL | } else {
|
|
|
|
| ____________^
|
|
|
|
LL | | if let Some(42) = Some(42) {
|
|
|
|
LL | | println!("world")
|
|
|
|
LL | | }
|
|
|
|
... |
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
|
|
|
|
|
2020-07-14 07:59:59 -05:00
|
|
|
help: collapse nested if block
|
2020-01-07 00:06:23 -06:00
|
|
|
|
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~ } else if let Some(42) = Some(42) {
|
|
|
|
LL + println!("world")
|
|
|
|
LL + }
|
|
|
|
LL + else {
|
|
|
|
LL + println!("!")
|
|
|
|
LL + }
|
2020-01-07 00:06:23 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
2024-08-24 12:43:34 -05:00
|
|
|
--> tests/ui/collapsible_else_if.rs:60:12
|
2020-01-07 00:06:23 -06:00
|
|
|
|
|
|
|
|
LL | } else {
|
|
|
|
| ____________^
|
|
|
|
LL | | if x == "hello" {
|
|
|
|
LL | | println!("world")
|
|
|
|
LL | | }
|
|
|
|
... |
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
|
|
|
|
|
2020-07-14 07:59:59 -05:00
|
|
|
help: collapse nested if block
|
2020-01-07 00:06:23 -06:00
|
|
|
|
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~ } else if x == "hello" {
|
|
|
|
LL + println!("world")
|
|
|
|
LL + }
|
|
|
|
LL + else {
|
|
|
|
LL + println!("!")
|
|
|
|
LL + }
|
2020-01-07 00:06:23 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
2024-08-24 12:43:34 -05:00
|
|
|
--> tests/ui/collapsible_else_if.rs:71:12
|
2020-01-07 00:06:23 -06:00
|
|
|
|
|
|
|
|
LL | } else {
|
|
|
|
| ____________^
|
|
|
|
LL | | if let Some(42) = Some(42) {
|
|
|
|
LL | | println!("world")
|
|
|
|
LL | | }
|
|
|
|
... |
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
|
|
|
|
|
2020-07-14 07:59:59 -05:00
|
|
|
help: collapse nested if block
|
2020-01-07 00:06:23 -06:00
|
|
|
|
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~ } else if let Some(42) = Some(42) {
|
|
|
|
LL + println!("world")
|
|
|
|
LL + }
|
|
|
|
LL + else {
|
|
|
|
LL + println!("!")
|
|
|
|
LL + }
|
2020-01-07 00:06:23 -06:00
|
|
|
|
|
|
|
|
|
2022-05-05 09:12:52 -05:00
|
|
|
error: this `else { if .. }` block can be collapsed
|
2024-08-24 12:43:34 -05:00
|
|
|
--> tests/ui/collapsible_else_if.rs:93:10
|
2022-05-05 09:12:52 -05:00
|
|
|
|
|
|
|
|
LL | }else{
|
|
|
|
| __________^
|
|
|
|
LL | | if false {}
|
|
|
|
LL | | }
|
|
|
|
| |_____^ help: collapse nested if block: `if false {}`
|
|
|
|
|
|
|
|
error: aborting due to 8 previous errors
|
2020-01-07 00:06:23 -06:00
|
|
|
|