mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 15:14:29 +00:00
164 lines
3.5 KiB
Text
164 lines
3.5 KiB
Text
error: this `else { if .. }` block can be collapsed
|
|
--> tests/ui/collapsible_else_if.rs:13:12
|
|
|
|
|
LL | } else {
|
|
| ____________^
|
|
LL | | if y == "world" {
|
|
LL | | println!("world!")
|
|
LL | | }
|
|
LL | | }
|
|
| |_____^
|
|
|
|
|
= note: `-D clippy::collapsible-else-if` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::collapsible_else_if)]`
|
|
help: collapse nested if block
|
|
|
|
|
LL ~ } else if y == "world" {
|
|
LL + println!("world!")
|
|
LL + }
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
|
--> tests/ui/collapsible_else_if.rs:21:12
|
|
|
|
|
LL | } else {
|
|
| ____________^
|
|
LL | | if let Some(42) = Some(42) {
|
|
LL | | println!("world!")
|
|
LL | | }
|
|
LL | | }
|
|
| |_____^
|
|
|
|
|
help: collapse nested if block
|
|
|
|
|
LL ~ } else if let Some(42) = Some(42) {
|
|
LL + println!("world!")
|
|
LL + }
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
|
--> tests/ui/collapsible_else_if.rs:29:12
|
|
|
|
|
LL | } else {
|
|
| ____________^
|
|
LL | | if y == "world" {
|
|
LL | | println!("world")
|
|
LL | | }
|
|
... |
|
|
LL | | }
|
|
LL | | }
|
|
| |_____^
|
|
|
|
|
help: collapse nested if block
|
|
|
|
|
LL ~ } else if y == "world" {
|
|
LL + println!("world")
|
|
LL + }
|
|
LL + else {
|
|
LL + println!("!")
|
|
LL + }
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
|
--> tests/ui/collapsible_else_if.rs:40:12
|
|
|
|
|
LL | } else {
|
|
| ____________^
|
|
LL | | if let Some(42) = Some(42) {
|
|
LL | | println!("world")
|
|
LL | | }
|
|
... |
|
|
LL | | }
|
|
LL | | }
|
|
| |_____^
|
|
|
|
|
help: collapse nested if block
|
|
|
|
|
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
|
|
--> tests/ui/collapsible_else_if.rs:51:12
|
|
|
|
|
LL | } else {
|
|
| ____________^
|
|
LL | | if let Some(42) = Some(42) {
|
|
LL | | println!("world")
|
|
LL | | }
|
|
... |
|
|
LL | | }
|
|
LL | | }
|
|
| |_____^
|
|
|
|
|
help: collapse nested if block
|
|
|
|
|
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
|
|
--> tests/ui/collapsible_else_if.rs:62:12
|
|
|
|
|
LL | } else {
|
|
| ____________^
|
|
LL | | if x == "hello" {
|
|
LL | | println!("world")
|
|
LL | | }
|
|
... |
|
|
LL | | }
|
|
LL | | }
|
|
| |_____^
|
|
|
|
|
help: collapse nested if block
|
|
|
|
|
LL ~ } else if x == "hello" {
|
|
LL + println!("world")
|
|
LL + }
|
|
LL + else {
|
|
LL + println!("!")
|
|
LL + }
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
|
--> tests/ui/collapsible_else_if.rs:73:12
|
|
|
|
|
LL | } else {
|
|
| ____________^
|
|
LL | | if let Some(42) = Some(42) {
|
|
LL | | println!("world")
|
|
LL | | }
|
|
... |
|
|
LL | | }
|
|
LL | | }
|
|
| |_____^
|
|
|
|
|
help: collapse nested if block
|
|
|
|
|
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
|
|
--> tests/ui/collapsible_else_if.rs:96:10
|
|
|
|
|
LL | }else{
|
|
| __________^
|
|
LL | | if false {}
|
|
LL | | }
|
|
| |_____^ help: collapse nested if block: `if false {}`
|
|
|
|
error: aborting due to 8 previous errors
|
|
|