2017-02-07 20:05:30 +00:00
|
|
|
error: this if statement can be collapsed
|
2019-01-07 21:33:18 +00:00
|
|
|
--> $DIR/collapsible_if.rs:6: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`
|
2017-02-07 20:05:30 +00:00
|
|
|
help: try
|
2017-07-10 13:29:29 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | if x == "hello" && y == "world" {
|
|
|
|
LL | println!("Hello world!");
|
|
|
|
LL | }
|
2017-07-10 13:29:29 +00:00
|
|
|
|
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
|
|
error: this if statement can be collapsed
|
2019-01-07 21:33:18 +00:00
|
|
|
--> $DIR/collapsible_if.rs:12: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
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
help: try
|
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") {
|
|
|
|
LL | println!("Hello world!");
|
|
|
|
LL | }
|
2017-07-10 13:29:29 +00:00
|
|
|
|
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
|
|
error: this if statement can be collapsed
|
2019-01-07 21:33:18 +00:00
|
|
|
--> $DIR/collapsible_if.rs:18: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
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
help: try
|
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") {
|
|
|
|
LL | println!("Hello world!");
|
|
|
|
LL | }
|
2017-07-10 13:29:29 +00:00
|
|
|
|
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
|
|
error: this if statement can be collapsed
|
2019-01-07 21:33:18 +00:00
|
|
|
--> $DIR/collapsible_if.rs:24: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
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
help: try
|
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" {
|
|
|
|
LL | println!("Hello world!");
|
|
|
|
LL | }
|
2017-07-10 13:29:29 +00:00
|
|
|
|
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
|
|
error: this if statement can be collapsed
|
2019-01-07 21:33:18 +00:00
|
|
|
--> $DIR/collapsible_if.rs:30: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
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
help: try
|
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" {
|
|
|
|
LL | println!("Hello world!");
|
|
|
|
LL | }
|
2017-07-10 13:29:29 +00:00
|
|
|
|
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
|
|
error: this if statement can be collapsed
|
2019-01-07 21:33:18 +00:00
|
|
|
--> $DIR/collapsible_if.rs:36: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
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
help: try
|
2017-07-10 13:29:29 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | if 42 == 1337 && 'a' != 'A' {
|
|
|
|
LL | println!("world!")
|
|
|
|
LL | }
|
2017-07-10 13:29:29 +00:00
|
|
|
|
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
2019-01-07 21:33:18 +00:00
|
|
|
--> $DIR/collapsible_if.rs:45:12
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | } else {
|
2017-04-23 13:25:22 +00:00
|
|
|
| ____________^
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | | if y == "world" {
|
|
|
|
LL | | println!("world!")
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
2017-04-23 13:25:22 +00:00
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
help: try
|
2017-07-10 13:29:29 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | } else if y == "world" {
|
|
|
|
LL | println!("world!")
|
|
|
|
LL | }
|
2017-07-10 13:29:29 +00:00
|
|
|
|
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
2019-01-07 21:33:18 +00:00
|
|
|
--> $DIR/collapsible_if.rs:53:12
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | } else {
|
2017-04-23 13:25:22 +00:00
|
|
|
| ____________^
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | | if let Some(42) = Some(42) {
|
|
|
|
LL | | println!("world!")
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
2017-04-23 13:25:22 +00:00
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
help: try
|
2017-07-10 13:29:29 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | } else if let Some(42) = Some(42) {
|
|
|
|
LL | println!("world!")
|
|
|
|
LL | }
|
2017-07-10 13:29:29 +00:00
|
|
|
|
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
2019-01-07 21:33:18 +00:00
|
|
|
--> $DIR/collapsible_if.rs:61:12
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | } else {
|
2017-04-23 13:25:22 +00:00
|
|
|
| ____________^
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | | if y == "world" {
|
|
|
|
LL | | println!("world")
|
|
|
|
LL | | }
|
2017-04-10 13:36:07 +00:00
|
|
|
... |
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | | }
|
|
|
|
LL | | }
|
2017-04-23 13:25:22 +00:00
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
help: try
|
2017-07-10 13:29:29 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | } else if y == "world" {
|
|
|
|
LL | println!("world")
|
|
|
|
LL | }
|
|
|
|
LL | else {
|
|
|
|
LL | println!("!")
|
|
|
|
LL | }
|
2017-07-10 13:29:29 +00:00
|
|
|
|
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
2019-01-07 21:33:18 +00:00
|
|
|
--> $DIR/collapsible_if.rs:72:12
|
2017-05-11 10:00:31 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | } else {
|
2017-05-11 10:00:31 +00:00
|
|
|
| ____________^
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | | if let Some(42) = Some(42) {
|
|
|
|
LL | | println!("world")
|
|
|
|
LL | | }
|
2017-05-11 10:00:31 +00:00
|
|
|
... |
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | | }
|
|
|
|
LL | | }
|
2017-05-11 10:00:31 +00:00
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
help: try
|
2017-07-10 13:29:29 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | } else if let Some(42) = Some(42) {
|
|
|
|
LL | println!("world")
|
|
|
|
LL | }
|
|
|
|
LL | else {
|
|
|
|
LL | println!("!")
|
|
|
|
LL | }
|
2017-07-10 13:29:29 +00:00
|
|
|
|
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
2019-01-07 21:33:18 +00:00
|
|
|
--> $DIR/collapsible_if.rs:83:12
|
2018-12-10 05:27:19 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | } else {
|
2018-12-10 05:27:19 +00:00
|
|
|
| ____________^
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | | if let Some(42) = Some(42) {
|
|
|
|
LL | | println!("world")
|
|
|
|
LL | | }
|
2018-12-10 05:27:19 +00:00
|
|
|
... |
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | | }
|
|
|
|
LL | | }
|
2018-12-10 05:27:19 +00:00
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
help: try
|
2018-12-10 05:27:19 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | } else if let Some(42) = Some(42) {
|
|
|
|
LL | println!("world")
|
|
|
|
LL | }
|
|
|
|
LL | else {
|
|
|
|
LL | println!("!")
|
|
|
|
LL | }
|
2018-12-10 05:27:19 +00:00
|
|
|
|
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
2019-01-07 21:33:18 +00:00
|
|
|
--> $DIR/collapsible_if.rs:94:12
|
2018-12-27 15:57:55 +00:00
|
|
|
|
|
|
|
|
LL | } else {
|
|
|
|
| ____________^
|
|
|
|
LL | | if x == "hello" {
|
|
|
|
LL | | println!("world")
|
|
|
|
LL | | }
|
|
|
|
... |
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
help: try
|
2018-12-27 15:57:55 +00:00
|
|
|
|
|
|
|
|
LL | } else if x == "hello" {
|
|
|
|
LL | println!("world")
|
|
|
|
LL | }
|
|
|
|
LL | else {
|
|
|
|
LL | println!("!")
|
|
|
|
LL | }
|
|
|
|
|
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
2019-01-07 21:33:18 +00:00
|
|
|
--> $DIR/collapsible_if.rs:105:12
|
2018-12-27 15:57:55 +00:00
|
|
|
|
|
|
|
|
LL | } else {
|
|
|
|
| ____________^
|
|
|
|
LL | | if let Some(42) = Some(42) {
|
|
|
|
LL | | println!("world")
|
|
|
|
LL | | }
|
|
|
|
... |
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
help: try
|
2018-12-27 15:57:55 +00:00
|
|
|
|
|
|
|
|
LL | } else if let Some(42) = Some(42) {
|
|
|
|
LL | println!("world")
|
|
|
|
LL | }
|
|
|
|
LL | else {
|
|
|
|
LL | println!("!")
|
|
|
|
LL | }
|
|
|
|
|
|
2017-02-07 20:05:30 +00:00
|
|
|
|
2018-10-16 20:20:27 +00:00
|
|
|
error: this if statement can be collapsed
|
2019-01-07 21:33:18 +00:00
|
|
|
--> $DIR/collapsible_if.rs:164:5
|
2018-12-27 15:57:55 +00:00
|
|
|
|
|
|
|
|
LL | / if x == "hello" {
|
|
|
|
LL | | if y == "world" { // Collapsible
|
|
|
|
LL | | println!("Hello world!");
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
2018-10-16 20:20:27 +00:00
|
|
|
help: try
|
2018-12-27 15:57:55 +00:00
|
|
|
|
|
|
|
|
LL | if x == "hello" && y == "world" { // Collapsible
|
|
|
|
LL | println!("Hello world!");
|
|
|
|
LL | }
|
|
|
|
|
|
2018-10-16 20:20:27 +00:00
|
|
|
|
|
|
|
error: aborting due to 14 previous errors
|
2018-01-16 16:06:27 +00:00
|
|
|
|