mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-21 02:23:19 +00:00
138 lines
3.5 KiB
Text
138 lines
3.5 KiB
Text
error: this `if` statement can be collapsed
|
|
--> $DIR/collapsible_if.rs:14: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: collapse nested if block
|
|
|
|
|
LL ~ if x == "hello" && y == "world" {
|
|
LL + println!("Hello world!");
|
|
LL + }
|
|
|
|
|
|
|
error: this `if` statement can be collapsed
|
|
--> $DIR/collapsible_if.rs:20:5
|
|
|
|
|
LL | / if x == "hello" || x == "world" {
|
|
LL | | if y == "world" || y == "hello" {
|
|
LL | | println!("Hello world!");
|
|
LL | | }
|
|
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:26:5
|
|
|
|
|
LL | / if x == "hello" && x == "world" {
|
|
LL | | if y == "world" || y == "hello" {
|
|
LL | | println!("Hello world!");
|
|
LL | | }
|
|
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:32:5
|
|
|
|
|
LL | / if x == "hello" || x == "world" {
|
|
LL | | if y == "world" && y == "hello" {
|
|
LL | | println!("Hello world!");
|
|
LL | | }
|
|
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:38:5
|
|
|
|
|
LL | / if x == "hello" && x == "world" {
|
|
LL | | if y == "world" && y == "hello" {
|
|
LL | | println!("Hello world!");
|
|
LL | | }
|
|
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:44:5
|
|
|
|
|
LL | / if 42 == 1337 {
|
|
LL | | if 'a' != 'A' {
|
|
LL | | println!("world!")
|
|
LL | | }
|
|
LL | | }
|
|
| |_____^
|
|
|
|
|
help: collapse nested if block
|
|
|
|
|
LL ~ if 42 == 1337 && 'a' != 'A' {
|
|
LL + println!("world!")
|
|
LL + }
|
|
|
|
|
|
|
error: this `if` statement can be collapsed
|
|
--> $DIR/collapsible_if.rs:100:5
|
|
|
|
|
LL | / if x == "hello" {
|
|
LL | | if y == "world" { // Collapsible
|
|
LL | | println!("Hello world!");
|
|
LL | | }
|
|
LL | | }
|
|
| |_____^
|
|
|
|
|
help: collapse nested if block
|
|
|
|
|
LL ~ if x == "hello" && y == "world" { // Collapsible
|
|
LL + println!("Hello world!");
|
|
LL + }
|
|
|
|
|
|
|
error: this `if` statement can be collapsed
|
|
--> $DIR/collapsible_if.rs:159: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: this `if` statement can be collapsed
|
|
--> $DIR/collapsible_if.rs:164:5
|
|
|
|
|
LL | / if matches!(true, true) && truth() {
|
|
LL | | if matches!(true, true) {}
|
|
LL | | }
|
|
| |_____^ help: collapse nested if block: `if matches!(true, true) && truth() && matches!(true, true) {}`
|
|
|
|
error: aborting due to 9 previous errors
|
|
|