2020-01-06 00:36:33 -06:00
|
|
|
error: this `if` statement can be collapsed
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/collapsible_if.rs:14:5
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | / if x == "hello" {
|
|
|
|
LL | | if y == "world" {
|
|
|
|
LL | | println!("Hello world!");
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
2017-04-23 08:25:22 -05:00
|
|
|
| |_____^
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-08-01 09:30:44 -05:00
|
|
|
= note: `-D clippy::collapsible-if` implied by `-D warnings`
|
2023-08-01 07:02:21 -05:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::collapsible_if)]`
|
2020-07-14 07:59:59 -05:00
|
|
|
help: collapse nested if block
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~ if x == "hello" && y == "world" {
|
|
|
|
LL + println!("Hello world!");
|
|
|
|
LL + }
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
2020-01-06 00:36:33 -06:00
|
|
|
error: this `if` statement can be collapsed
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/collapsible_if.rs:20:5
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | / if x == "hello" || x == "world" {
|
|
|
|
LL | | if y == "world" || y == "hello" {
|
|
|
|
LL | | println!("Hello world!");
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
2017-04-23 08:25:22 -05:00
|
|
|
| |_____^
|
2019-10-26 14:53:42 -05:00
|
|
|
|
|
2020-07-14 07:59:59 -05:00
|
|
|
help: collapse nested if block
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~ if (x == "hello" || x == "world") && (y == "world" || y == "hello") {
|
|
|
|
LL + println!("Hello world!");
|
|
|
|
LL + }
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
2020-01-06 00:36:33 -06:00
|
|
|
error: this `if` statement can be collapsed
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/collapsible_if.rs:26:5
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | / if x == "hello" && x == "world" {
|
|
|
|
LL | | if y == "world" || y == "hello" {
|
|
|
|
LL | | println!("Hello world!");
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
2017-04-23 08:25:22 -05:00
|
|
|
| |_____^
|
2019-10-26 14:53:42 -05:00
|
|
|
|
|
2020-07-14 07:59:59 -05:00
|
|
|
help: collapse nested if block
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~ if x == "hello" && x == "world" && (y == "world" || y == "hello") {
|
|
|
|
LL + println!("Hello world!");
|
|
|
|
LL + }
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
2020-01-06 00:36:33 -06:00
|
|
|
error: this `if` statement can be collapsed
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/collapsible_if.rs:32:5
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | / if x == "hello" || x == "world" {
|
|
|
|
LL | | if y == "world" && y == "hello" {
|
|
|
|
LL | | println!("Hello world!");
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
2017-04-23 08:25:22 -05:00
|
|
|
| |_____^
|
2019-10-26 14:53:42 -05:00
|
|
|
|
|
2020-07-14 07:59:59 -05:00
|
|
|
help: collapse nested if block
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~ if (x == "hello" || x == "world") && y == "world" && y == "hello" {
|
|
|
|
LL + println!("Hello world!");
|
|
|
|
LL + }
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
2020-01-06 00:36:33 -06:00
|
|
|
error: this `if` statement can be collapsed
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/collapsible_if.rs:38:5
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | / if x == "hello" && x == "world" {
|
|
|
|
LL | | if y == "world" && y == "hello" {
|
|
|
|
LL | | println!("Hello world!");
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
2017-04-23 08:25:22 -05:00
|
|
|
| |_____^
|
2019-10-26 14:53:42 -05:00
|
|
|
|
|
2020-07-14 07:59:59 -05:00
|
|
|
help: collapse nested if block
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~ if x == "hello" && x == "world" && y == "world" && y == "hello" {
|
|
|
|
LL + println!("Hello world!");
|
|
|
|
LL + }
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
2020-01-06 00:36:33 -06:00
|
|
|
error: this `if` statement can be collapsed
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/collapsible_if.rs:44:5
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | / if 42 == 1337 {
|
|
|
|
LL | | if 'a' != 'A' {
|
|
|
|
LL | | println!("world!")
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
2017-04-23 08:25:22 -05:00
|
|
|
| |_____^
|
2019-10-26 14:53:42 -05:00
|
|
|
|
|
2020-07-14 07:59:59 -05:00
|
|
|
help: collapse nested if block
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~ if 42 == 1337 && 'a' != 'A' {
|
|
|
|
LL + println!("world!")
|
|
|
|
LL + }
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
2020-01-06 00:36:33 -06:00
|
|
|
error: this `if` statement can be collapsed
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/collapsible_if.rs:100:5
|
2018-12-27 09:57:55 -06:00
|
|
|
|
|
|
|
|
LL | / if x == "hello" {
|
|
|
|
LL | | if y == "world" { // Collapsible
|
|
|
|
LL | | println!("Hello world!");
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
2019-10-26 14:53:42 -05:00
|
|
|
|
|
2020-07-14 07:59:59 -05:00
|
|
|
help: collapse nested if block
|
2018-12-27 09:57:55 -06:00
|
|
|
|
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~ if x == "hello" && y == "world" { // Collapsible
|
|
|
|
LL + println!("Hello world!");
|
|
|
|
LL + }
|
2018-12-27 09:57:55 -06:00
|
|
|
|
|
2018-10-16 15:20:27 -05:00
|
|
|
|
2020-09-10 10:47:07 -05:00
|
|
|
error: this `if` statement can be collapsed
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/collapsible_if.rs:159:5
|
2020-09-10 10:47:07 -05:00
|
|
|
|
|
|
|
|
LL | / if matches!(true, true) {
|
|
|
|
LL | | if matches!(true, true) {}
|
|
|
|
LL | | }
|
|
|
|
| |_____^ help: collapse nested if block: `if matches!(true, true) && matches!(true, true) {}`
|
|
|
|
|
2022-09-21 12:02:37 -05:00
|
|
|
error: this `if` statement can be collapsed
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/collapsible_if.rs:164:5
|
2022-09-21 12:02:37 -05:00
|
|
|
|
|
|
|
|
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
|
2018-01-16 10:06:27 -06:00
|
|
|
|