rust/tests/ui/collapsible_else_if.stderr
Matthias Krüger 6dcec6ae86 collapsible_if: split collapsible_else_if into its own lint so we can enable/disable it particularly
This splits up clippy::collapsible_if into collapsible_if for
if x {
  if y { }
}
=>
if x && y { }

and collapsible_else_if for

if x {
} else {
 if y { }
}

=>
if x {

} else if y {

}

so that we can lint for only the latter but not the first if we desire.

changelog: collapsible_if: split up linting for if x {} else { if y {} } into collapsible_else_if lint
2021-01-04 13:34:14 +01:00

155 lines
3.1 KiB
Plaintext

error: this `else { if .. }` block can be collapsed
--> $DIR/collapsible_else_if.rs:14:12
|
LL | } else {
| ____________^
LL | | if y == "world" {
LL | | println!("world!")
LL | | }
LL | | }
| |_____^
|
= note: `-D clippy::collapsible-else-if` implied by `-D warnings`
help: collapse nested if block
|
LL | } else if y == "world" {
LL | println!("world!")
LL | }
|
error: this `else { if .. }` block can be collapsed
--> $DIR/collapsible_else_if.rs:22: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
--> $DIR/collapsible_else_if.rs:30: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
--> $DIR/collapsible_else_if.rs:41: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
--> $DIR/collapsible_else_if.rs:52: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
--> $DIR/collapsible_else_if.rs:63: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
--> $DIR/collapsible_else_if.rs:74: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: aborting due to 7 previous errors