2020-01-06 06:36:33 +00:00
|
|
|
error: this `if` statement can be collapsed
|
2019-01-13 10:44:45 +00:00
|
|
|
--> $DIR/collapsible_if.rs:9:5
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | / if x == "hello" {
|
|
|
|
LL | | if y == "world" {
|
|
|
|
LL | | println!("Hello world!");
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
2017-04-23 13:25:22 +00:00
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2018-08-01 14:30:44 +00:00
|
|
|
= note: `-D clippy::collapsible-if` implied by `-D warnings`
|
2020-07-14 12:59:59 +00:00
|
|
|
help: collapse nested if block
|
2017-07-10 13:29:29 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | if x == "hello" && y == "world" {
|
2020-02-04 15:13:06 +00:00
|
|
|
LL | println!("Hello world!");
|
|
|
|
LL | }
|
2017-07-10 13:29:29 +00:00
|
|
|
|
|
2017-02-07 20:05:30 +00:00
|
|
|
|
2020-01-06 06:36:33 +00:00
|
|
|
error: this `if` statement can be collapsed
|
2019-01-13 10:44:45 +00:00
|
|
|
--> $DIR/collapsible_if.rs:15:5
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | / if x == "hello" || x == "world" {
|
|
|
|
LL | | if y == "world" || y == "hello" {
|
|
|
|
LL | | println!("Hello world!");
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
2017-04-23 13:25:22 +00:00
|
|
|
| |_____^
|
2019-10-26 19:53:42 +00:00
|
|
|
|
|
2020-07-14 12:59:59 +00:00
|
|
|
help: collapse nested if block
|
2017-07-10 13:29:29 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | if (x == "hello" || x == "world") && (y == "world" || y == "hello") {
|
2020-02-04 15:13:06 +00:00
|
|
|
LL | println!("Hello world!");
|
|
|
|
LL | }
|
2017-07-10 13:29:29 +00:00
|
|
|
|
|
2017-02-07 20:05:30 +00:00
|
|
|
|
2020-01-06 06:36:33 +00:00
|
|
|
error: this `if` statement can be collapsed
|
2019-01-13 10:44:45 +00:00
|
|
|
--> $DIR/collapsible_if.rs:21:5
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | / if x == "hello" && x == "world" {
|
|
|
|
LL | | if y == "world" || y == "hello" {
|
|
|
|
LL | | println!("Hello world!");
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
2017-04-23 13:25:22 +00:00
|
|
|
| |_____^
|
2019-10-26 19:53:42 +00:00
|
|
|
|
|
2020-07-14 12:59:59 +00:00
|
|
|
help: collapse nested if block
|
2017-07-10 13:29:29 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | if x == "hello" && x == "world" && (y == "world" || y == "hello") {
|
2020-02-04 15:13:06 +00:00
|
|
|
LL | println!("Hello world!");
|
|
|
|
LL | }
|
2017-07-10 13:29:29 +00:00
|
|
|
|
|
2017-02-07 20:05:30 +00:00
|
|
|
|
2020-01-06 06:36:33 +00:00
|
|
|
error: this `if` statement can be collapsed
|
2019-01-13 10:44:45 +00:00
|
|
|
--> $DIR/collapsible_if.rs:27:5
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | / if x == "hello" || x == "world" {
|
|
|
|
LL | | if y == "world" && y == "hello" {
|
|
|
|
LL | | println!("Hello world!");
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
2017-04-23 13:25:22 +00:00
|
|
|
| |_____^
|
2019-10-26 19:53:42 +00:00
|
|
|
|
|
2020-07-14 12:59:59 +00:00
|
|
|
help: collapse nested if block
|
2017-07-10 13:29:29 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | if (x == "hello" || x == "world") && y == "world" && y == "hello" {
|
2020-02-04 15:13:06 +00:00
|
|
|
LL | println!("Hello world!");
|
|
|
|
LL | }
|
2017-07-10 13:29:29 +00:00
|
|
|
|
|
2017-02-07 20:05:30 +00:00
|
|
|
|
2020-01-06 06:36:33 +00:00
|
|
|
error: this `if` statement can be collapsed
|
2019-01-13 10:44:45 +00:00
|
|
|
--> $DIR/collapsible_if.rs:33:5
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | / if x == "hello" && x == "world" {
|
|
|
|
LL | | if y == "world" && y == "hello" {
|
|
|
|
LL | | println!("Hello world!");
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
2017-04-23 13:25:22 +00:00
|
|
|
| |_____^
|
2019-10-26 19:53:42 +00:00
|
|
|
|
|
2020-07-14 12:59:59 +00:00
|
|
|
help: collapse nested if block
|
2017-07-10 13:29:29 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | if x == "hello" && x == "world" && y == "world" && y == "hello" {
|
2020-02-04 15:13:06 +00:00
|
|
|
LL | println!("Hello world!");
|
|
|
|
LL | }
|
2017-07-10 13:29:29 +00:00
|
|
|
|
|
2017-02-07 20:05:30 +00:00
|
|
|
|
2020-01-06 06:36:33 +00:00
|
|
|
error: this `if` statement can be collapsed
|
2019-01-13 10:44:45 +00:00
|
|
|
--> $DIR/collapsible_if.rs:39:5
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | / if 42 == 1337 {
|
|
|
|
LL | | if 'a' != 'A' {
|
|
|
|
LL | | println!("world!")
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
2017-04-23 13:25:22 +00:00
|
|
|
| |_____^
|
2019-10-26 19:53:42 +00:00
|
|
|
|
|
2020-07-14 12:59:59 +00:00
|
|
|
help: collapse nested if block
|
2017-07-10 13:29:29 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | if 42 == 1337 && 'a' != 'A' {
|
2020-02-04 15:13:06 +00:00
|
|
|
LL | println!("world!")
|
|
|
|
LL | }
|
2017-07-10 13:29:29 +00:00
|
|
|
|
|
2017-02-07 20:05:30 +00:00
|
|
|
|
2020-01-06 06:36:33 +00:00
|
|
|
error: this `if` statement can be collapsed
|
2020-01-07 06:06:23 +00:00
|
|
|
--> $DIR/collapsible_if.rs:95:5
|
2018-12-27 15:57:55 +00:00
|
|
|
|
|
|
|
|
LL | / if x == "hello" {
|
|
|
|
LL | | if y == "world" { // Collapsible
|
|
|
|
LL | | println!("Hello world!");
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
2019-10-26 19:53:42 +00:00
|
|
|
|
|
2020-07-14 12:59:59 +00:00
|
|
|
help: collapse nested if block
|
2018-12-27 15:57:55 +00:00
|
|
|
|
|
|
|
|
LL | if x == "hello" && y == "world" { // Collapsible
|
2020-02-04 15:13:06 +00:00
|
|
|
LL | println!("Hello world!");
|
|
|
|
LL | }
|
2018-12-27 15:57:55 +00:00
|
|
|
|
|
2018-10-16 20:20:27 +00:00
|
|
|
|
2020-09-10 15:47:07 +00:00
|
|
|
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 8 previous errors
|
2018-01-16 16:06:27 +00:00
|
|
|
|