2017-02-07 14:05:30 -06:00
|
|
|
error: this if statement can be collapsed
|
2017-08-01 10:54:21 -05:00
|
|
|
--> $DIR/collapsible_if.rs:8:5
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2017-04-23 08:25:22 -05:00
|
|
|
8 | / if x == "hello" {
|
2017-05-11 05:00:31 -05:00
|
|
|
9 | | if y == "world" {
|
|
|
|
10 | | println!("Hello world!");
|
|
|
|
11 | | }
|
|
|
|
12 | | }
|
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`
|
2017-02-07 14:05:30 -06:00
|
|
|
help: try
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
|
|
|
8 | if x == "hello" && y == "world" {
|
|
|
|
9 | println!("Hello world!");
|
|
|
|
10 | }
|
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
|
|
error: this if statement can be collapsed
|
2017-08-01 10:54:21 -05:00
|
|
|
--> $DIR/collapsible_if.rs:14:5
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2017-05-11 05:00:31 -05:00
|
|
|
14 | / if x == "hello" || x == "world" {
|
|
|
|
15 | | if y == "world" || y == "hello" {
|
|
|
|
16 | | println!("Hello world!");
|
|
|
|
17 | | }
|
|
|
|
18 | | }
|
2017-04-23 08:25:22 -05:00
|
|
|
| |_____^
|
2017-02-07 14:05:30 -06:00
|
|
|
help: try
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
|
|
|
14 | if (x == "hello" || x == "world") && (y == "world" || y == "hello") {
|
|
|
|
15 | println!("Hello world!");
|
|
|
|
16 | }
|
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
|
|
error: this if statement can be collapsed
|
2017-08-01 10:54:21 -05:00
|
|
|
--> $DIR/collapsible_if.rs:20:5
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2017-05-11 05:00:31 -05:00
|
|
|
20 | / if x == "hello" && x == "world" {
|
|
|
|
21 | | if y == "world" || y == "hello" {
|
|
|
|
22 | | println!("Hello world!");
|
|
|
|
23 | | }
|
|
|
|
24 | | }
|
2017-04-23 08:25:22 -05:00
|
|
|
| |_____^
|
2017-02-07 14:05:30 -06:00
|
|
|
help: try
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
|
|
|
20 | if x == "hello" && x == "world" && (y == "world" || y == "hello") {
|
|
|
|
21 | println!("Hello world!");
|
|
|
|
22 | }
|
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
|
|
error: this if statement can be collapsed
|
2017-08-01 10:54:21 -05:00
|
|
|
--> $DIR/collapsible_if.rs:26:5
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2017-05-11 05:00:31 -05:00
|
|
|
26 | / if x == "hello" || x == "world" {
|
|
|
|
27 | | if y == "world" && y == "hello" {
|
|
|
|
28 | | println!("Hello world!");
|
|
|
|
29 | | }
|
|
|
|
30 | | }
|
2017-04-23 08:25:22 -05:00
|
|
|
| |_____^
|
2017-02-07 14:05:30 -06:00
|
|
|
help: try
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
|
|
|
26 | if (x == "hello" || x == "world") && y == "world" && y == "hello" {
|
|
|
|
27 | println!("Hello world!");
|
|
|
|
28 | }
|
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
|
|
error: this if statement can be collapsed
|
2017-08-01 10:54:21 -05:00
|
|
|
--> $DIR/collapsible_if.rs:32:5
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2017-05-11 05:00:31 -05:00
|
|
|
32 | / if x == "hello" && x == "world" {
|
|
|
|
33 | | if y == "world" && y == "hello" {
|
|
|
|
34 | | println!("Hello world!");
|
|
|
|
35 | | }
|
|
|
|
36 | | }
|
2017-04-23 08:25:22 -05:00
|
|
|
| |_____^
|
2017-02-07 14:05:30 -06:00
|
|
|
help: try
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
|
|
|
32 | if x == "hello" && x == "world" && y == "world" && y == "hello" {
|
|
|
|
33 | println!("Hello world!");
|
|
|
|
34 | }
|
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
|
|
error: this if statement can be collapsed
|
2017-08-01 10:54:21 -05:00
|
|
|
--> $DIR/collapsible_if.rs:38:5
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2017-05-11 05:00:31 -05:00
|
|
|
38 | / if 42 == 1337 {
|
|
|
|
39 | | if 'a' != 'A' {
|
|
|
|
40 | | println!("world!")
|
|
|
|
41 | | }
|
|
|
|
42 | | }
|
2017-04-23 08:25:22 -05:00
|
|
|
| |_____^
|
2017-02-07 14:05:30 -06:00
|
|
|
help: try
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
|
|
|
38 | if 42 == 1337 && 'a' != 'A' {
|
|
|
|
39 | println!("world!")
|
|
|
|
40 | }
|
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
2017-08-01 10:54:21 -05:00
|
|
|
--> $DIR/collapsible_if.rs:47:12
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2017-05-11 05:00:31 -05:00
|
|
|
47 | } else {
|
2017-04-23 08:25:22 -05:00
|
|
|
| ____________^
|
2017-05-11 05:00:31 -05:00
|
|
|
48 | | if y == "world" {
|
|
|
|
49 | | println!("world!")
|
|
|
|
50 | | }
|
|
|
|
51 | | }
|
2017-04-23 08:25:22 -05:00
|
|
|
| |_____^
|
2017-02-07 14:05:30 -06:00
|
|
|
help: try
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
|
|
|
47 | } else if y == "world" {
|
|
|
|
48 | println!("world!")
|
|
|
|
49 | }
|
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
2017-08-01 10:54:21 -05:00
|
|
|
--> $DIR/collapsible_if.rs:55:12
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2017-05-11 05:00:31 -05:00
|
|
|
55 | } else {
|
2017-04-23 08:25:22 -05:00
|
|
|
| ____________^
|
2017-05-11 05:00:31 -05:00
|
|
|
56 | | if let Some(42) = Some(42) {
|
|
|
|
57 | | println!("world!")
|
|
|
|
58 | | }
|
|
|
|
59 | | }
|
2017-04-23 08:25:22 -05:00
|
|
|
| |_____^
|
2017-02-07 14:05:30 -06:00
|
|
|
help: try
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
|
|
|
55 | } else if let Some(42) = Some(42) {
|
|
|
|
56 | println!("world!")
|
|
|
|
57 | }
|
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
2017-08-01 10:54:21 -05:00
|
|
|
--> $DIR/collapsible_if.rs:63:12
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2017-05-11 05:00:31 -05:00
|
|
|
63 | } else {
|
2017-04-23 08:25:22 -05:00
|
|
|
| ____________^
|
2017-05-11 05:00:31 -05:00
|
|
|
64 | | if y == "world" {
|
|
|
|
65 | | println!("world")
|
|
|
|
66 | | }
|
2017-04-10 08:36:07 -05:00
|
|
|
... |
|
2017-05-11 05:00:31 -05:00
|
|
|
69 | | }
|
|
|
|
70 | | }
|
2017-04-23 08:25:22 -05:00
|
|
|
| |_____^
|
2017-02-07 14:05:30 -06:00
|
|
|
help: try
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
|
|
|
63 | } else if y == "world" {
|
|
|
|
64 | println!("world")
|
|
|
|
65 | }
|
|
|
|
66 | else {
|
|
|
|
67 | println!("!")
|
|
|
|
68 | }
|
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
2017-08-01 10:54:21 -05:00
|
|
|
--> $DIR/collapsible_if.rs:74:12
|
2017-05-11 05:00:31 -05:00
|
|
|
|
|
|
|
|
74 | } else {
|
|
|
|
| ____________^
|
|
|
|
75 | | if let Some(42) = Some(42) {
|
|
|
|
76 | | println!("world")
|
|
|
|
77 | | }
|
|
|
|
... |
|
|
|
|
80 | | }
|
|
|
|
81 | | }
|
|
|
|
| |_____^
|
2017-02-07 14:05:30 -06:00
|
|
|
help: try
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
|
|
|
74 | } else if let Some(42) = Some(42) {
|
|
|
|
75 | println!("world")
|
|
|
|
76 | }
|
|
|
|
77 | else {
|
|
|
|
78 | println!("!")
|
|
|
|
79 | }
|
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
2017-08-01 10:54:21 -05:00
|
|
|
--> $DIR/collapsible_if.rs:85:12
|
2017-05-11 05:00:31 -05:00
|
|
|
|
|
|
|
|
85 | } else {
|
|
|
|
| ____________^
|
|
|
|
86 | | if let Some(42) = Some(42) {
|
|
|
|
87 | | println!("world")
|
|
|
|
88 | | }
|
|
|
|
... |
|
|
|
|
91 | | }
|
|
|
|
92 | | }
|
|
|
|
| |_____^
|
2017-02-07 14:05:30 -06:00
|
|
|
help: try
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
|
|
|
85 | } else if let Some(42) = Some(42) {
|
|
|
|
86 | println!("world")
|
|
|
|
87 | }
|
|
|
|
88 | else {
|
|
|
|
89 | println!("!")
|
|
|
|
90 | }
|
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
2017-08-01 10:54:21 -05:00
|
|
|
--> $DIR/collapsible_if.rs:96:12
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2017-05-11 05:00:31 -05:00
|
|
|
96 | } else {
|
2017-04-23 08:25:22 -05:00
|
|
|
| ____________^
|
2017-05-11 05:00:31 -05:00
|
|
|
97 | | if x == "hello" {
|
|
|
|
98 | | println!("world")
|
|
|
|
99 | | }
|
2017-04-10 08:36:07 -05:00
|
|
|
... |
|
2017-05-11 05:00:31 -05:00
|
|
|
102 | | }
|
|
|
|
103 | | }
|
2017-04-23 08:25:22 -05:00
|
|
|
| |_____^
|
2017-02-07 14:05:30 -06:00
|
|
|
help: try
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
|
|
|
96 | } else if x == "hello" {
|
|
|
|
97 | println!("world")
|
|
|
|
98 | }
|
|
|
|
99 | else {
|
|
|
|
100 | println!("!")
|
|
|
|
101 | }
|
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
2017-08-01 10:54:21 -05:00
|
|
|
--> $DIR/collapsible_if.rs:107:12
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2017-05-11 05:00:31 -05:00
|
|
|
107 | } else {
|
2017-04-23 08:25:22 -05:00
|
|
|
| ____________^
|
2017-05-11 05:00:31 -05:00
|
|
|
108 | | if let Some(42) = Some(42) {
|
|
|
|
109 | | println!("world")
|
|
|
|
110 | | }
|
2017-04-10 08:36:07 -05:00
|
|
|
... |
|
2017-05-11 05:00:31 -05:00
|
|
|
113 | | }
|
|
|
|
114 | | }
|
2017-04-23 08:25:22 -05:00
|
|
|
| |_____^
|
2017-02-07 14:05:30 -06:00
|
|
|
help: try
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
|
|
|
107 | } else if let Some(42) = Some(42) {
|
|
|
|
108 | println!("world")
|
|
|
|
109 | }
|
|
|
|
110 | else {
|
|
|
|
111 | println!("!")
|
|
|
|
112 | }
|
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
2018-01-16 10:06:27 -06:00
|
|
|
error: aborting due to 13 previous errors
|
|
|
|
|