2017-02-07 20:05:30 +00:00
|
|
|
error: this if statement can be collapsed
|
|
|
|
--> $DIR/collapsible_if.rs:8:5
|
|
|
|
|
|
2017-04-23 13:25:22 +00:00
|
|
|
8 | / if x == "hello" {
|
2017-02-08 13:58:07 +00:00
|
|
|
9 | |
|
|
|
|
10 | |
|
|
|
|
11 | |
|
2017-04-10 13:36:07 +00:00
|
|
|
... |
|
2017-02-07 20:05:30 +00:00
|
|
|
14 | | }
|
|
|
|
15 | | }
|
2017-04-23 13:25:22 +00:00
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
|
|
|
note: lint level defined here
|
|
|
|
--> $DIR/collapsible_if.rs:4:8
|
|
|
|
|
|
|
|
|
4 | #[deny(collapsible_if)]
|
|
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
help: try
|
|
|
|
| if x == "hello" && y == "world" {
|
|
|
|
| println!("Hello world!");
|
|
|
|
| }
|
|
|
|
|
|
|
|
error: this if statement can be collapsed
|
|
|
|
--> $DIR/collapsible_if.rs:17:5
|
|
|
|
|
|
2017-04-23 13:25:22 +00:00
|
|
|
17 | / if x == "hello" || x == "world" {
|
2017-02-08 13:58:07 +00:00
|
|
|
18 | |
|
|
|
|
19 | |
|
|
|
|
20 | |
|
2017-04-10 13:36:07 +00:00
|
|
|
... |
|
2017-02-07 20:05:30 +00:00
|
|
|
23 | | }
|
|
|
|
24 | | }
|
2017-04-23 13:25:22 +00:00
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
|
|
|
help: try
|
|
|
|
| if (x == "hello" || x == "world") && (y == "world" || y == "hello") {
|
|
|
|
| println!("Hello world!");
|
|
|
|
| }
|
|
|
|
|
|
|
|
error: this if statement can be collapsed
|
|
|
|
--> $DIR/collapsible_if.rs:26:5
|
|
|
|
|
|
2017-04-23 13:25:22 +00:00
|
|
|
26 | / if x == "hello" && x == "world" {
|
2017-02-08 13:58:07 +00:00
|
|
|
27 | |
|
|
|
|
28 | |
|
|
|
|
29 | |
|
2017-04-10 13:36:07 +00:00
|
|
|
... |
|
2017-02-07 20:05:30 +00:00
|
|
|
32 | | }
|
|
|
|
33 | | }
|
2017-04-23 13:25:22 +00:00
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
|
|
|
help: try
|
|
|
|
| if x == "hello" && x == "world" && (y == "world" || y == "hello") {
|
|
|
|
| println!("Hello world!");
|
|
|
|
| }
|
|
|
|
|
|
|
|
error: this if statement can be collapsed
|
|
|
|
--> $DIR/collapsible_if.rs:35:5
|
|
|
|
|
|
2017-04-23 13:25:22 +00:00
|
|
|
35 | / if x == "hello" || x == "world" {
|
2017-02-08 13:58:07 +00:00
|
|
|
36 | |
|
|
|
|
37 | |
|
|
|
|
38 | |
|
2017-04-10 13:36:07 +00:00
|
|
|
... |
|
2017-02-07 20:05:30 +00:00
|
|
|
41 | | }
|
|
|
|
42 | | }
|
2017-04-23 13:25:22 +00:00
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
|
|
|
help: try
|
|
|
|
| if (x == "hello" || x == "world") && y == "world" && y == "hello" {
|
|
|
|
| println!("Hello world!");
|
|
|
|
| }
|
|
|
|
|
|
|
|
error: this if statement can be collapsed
|
|
|
|
--> $DIR/collapsible_if.rs:44:5
|
|
|
|
|
|
2017-04-23 13:25:22 +00:00
|
|
|
44 | / if x == "hello" && x == "world" {
|
2017-02-08 13:58:07 +00:00
|
|
|
45 | |
|
|
|
|
46 | |
|
|
|
|
47 | |
|
2017-04-10 13:36:07 +00:00
|
|
|
... |
|
2017-02-07 20:05:30 +00:00
|
|
|
50 | | }
|
|
|
|
51 | | }
|
2017-04-23 13:25:22 +00:00
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
|
|
|
help: try
|
|
|
|
| if x == "hello" && x == "world" && y == "world" && y == "hello" {
|
|
|
|
| println!("Hello world!");
|
|
|
|
| }
|
|
|
|
|
|
|
|
error: this if statement can be collapsed
|
|
|
|
--> $DIR/collapsible_if.rs:53:5
|
|
|
|
|
|
2017-04-23 13:25:22 +00:00
|
|
|
53 | / if 42 == 1337 {
|
2017-02-08 13:58:07 +00:00
|
|
|
54 | |
|
|
|
|
55 | |
|
|
|
|
56 | |
|
2017-04-10 13:36:07 +00:00
|
|
|
... |
|
2017-02-07 20:05:30 +00:00
|
|
|
59 | | }
|
|
|
|
60 | | }
|
2017-04-23 13:25:22 +00:00
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
|
|
|
help: try
|
|
|
|
| if 42 == 1337 && 'a' != 'A' {
|
|
|
|
| println!("world!")
|
|
|
|
| }
|
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
|
|
|
--> $DIR/collapsible_if.rs:65:12
|
|
|
|
|
|
|
|
|
65 | } else {
|
2017-04-23 13:25:22 +00:00
|
|
|
| ____________^
|
2017-02-08 13:58:07 +00:00
|
|
|
66 | |
|
|
|
|
67 | |
|
|
|
|
68 | |
|
2017-04-10 13:36:07 +00:00
|
|
|
... |
|
2017-02-07 20:05:30 +00:00
|
|
|
71 | | }
|
|
|
|
72 | | }
|
2017-04-23 13:25:22 +00:00
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
|
|
|
help: try
|
|
|
|
| } else if y == "world" {
|
|
|
|
| println!("world!")
|
|
|
|
| }
|
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
|
|
|
--> $DIR/collapsible_if.rs:76:12
|
|
|
|
|
|
|
|
|
76 | } else {
|
2017-04-23 13:25:22 +00:00
|
|
|
| ____________^
|
2017-02-08 13:58:07 +00:00
|
|
|
77 | |
|
|
|
|
78 | |
|
|
|
|
79 | |
|
2017-04-10 13:36:07 +00:00
|
|
|
... |
|
2017-02-07 20:05:30 +00:00
|
|
|
82 | | }
|
|
|
|
83 | | }
|
2017-04-23 13:25:22 +00:00
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
|
|
|
help: try
|
|
|
|
| } else if let Some(42) = Some(42) {
|
|
|
|
| println!("world!")
|
|
|
|
| }
|
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
|
|
|
--> $DIR/collapsible_if.rs:87:12
|
|
|
|
|
|
2017-04-10 13:36:07 +00:00
|
|
|
87 | } else {
|
2017-04-23 13:25:22 +00:00
|
|
|
| ____________^
|
2017-04-10 13:36:07 +00:00
|
|
|
88 | |
|
|
|
|
89 | |
|
|
|
|
90 | |
|
|
|
|
... |
|
|
|
|
96 | | }
|
|
|
|
97 | | }
|
2017-04-23 13:25:22 +00:00
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
|
|
|
help: try
|
|
|
|
| } else if y == "world" {
|
|
|
|
| println!("world")
|
|
|
|
| }
|
|
|
|
| else {
|
|
|
|
| println!("!")
|
|
|
|
| }
|
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
|
|
|
--> $DIR/collapsible_if.rs:101:12
|
|
|
|
|
|
2017-04-10 13:36:07 +00:00
|
|
|
101 | } else {
|
2017-04-23 13:25:22 +00:00
|
|
|
| ____________^
|
2017-04-10 13:36:07 +00:00
|
|
|
102 | |
|
|
|
|
103 | |
|
|
|
|
104 | |
|
|
|
|
... |
|
|
|
|
110 | | }
|
|
|
|
111 | | }
|
2017-04-23 13:25:22 +00:00
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
|
|
|
help: try
|
|
|
|
| } else if let Some(42) = Some(42) {
|
|
|
|
| println!("world")
|
|
|
|
| }
|
|
|
|
| else {
|
|
|
|
| println!("!")
|
|
|
|
| }
|
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
|
|
|
--> $DIR/collapsible_if.rs:115:12
|
|
|
|
|
|
2017-04-10 13:36:07 +00:00
|
|
|
115 | } else {
|
2017-04-23 13:25:22 +00:00
|
|
|
| ____________^
|
2017-04-10 13:36:07 +00:00
|
|
|
116 | |
|
|
|
|
117 | |
|
|
|
|
118 | |
|
|
|
|
... |
|
|
|
|
124 | | }
|
|
|
|
125 | | }
|
2017-04-23 13:25:22 +00:00
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
|
|
|
help: try
|
|
|
|
| } else if let Some(42) = Some(42) {
|
|
|
|
| println!("world")
|
|
|
|
| }
|
|
|
|
| else {
|
|
|
|
| println!("!")
|
|
|
|
| }
|
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
|
|
|
--> $DIR/collapsible_if.rs:129:12
|
|
|
|
|
|
2017-04-10 13:36:07 +00:00
|
|
|
129 | } else {
|
2017-04-23 13:25:22 +00:00
|
|
|
| ____________^
|
2017-04-10 13:36:07 +00:00
|
|
|
130 | |
|
|
|
|
131 | |
|
|
|
|
132 | |
|
|
|
|
... |
|
|
|
|
138 | | }
|
|
|
|
139 | | }
|
2017-04-23 13:25:22 +00:00
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
|
|
|
help: try
|
|
|
|
| } else if x == "hello" {
|
|
|
|
| println!("world")
|
|
|
|
| }
|
|
|
|
| else {
|
|
|
|
| println!("!")
|
|
|
|
| }
|
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
|
|
|
--> $DIR/collapsible_if.rs:143:12
|
|
|
|
|
|
2017-04-10 13:36:07 +00:00
|
|
|
143 | } else {
|
2017-04-23 13:25:22 +00:00
|
|
|
| ____________^
|
2017-04-10 13:36:07 +00:00
|
|
|
144 | |
|
|
|
|
145 | |
|
|
|
|
146 | |
|
|
|
|
... |
|
|
|
|
152 | | }
|
|
|
|
153 | | }
|
2017-04-23 13:25:22 +00:00
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
|
|
|
help: try
|
|
|
|
| } else if let Some(42) = Some(42) {
|
|
|
|
| println!("world")
|
|
|
|
| }
|
|
|
|
| else {
|
|
|
|
| println!("!")
|
|
|
|
| }
|
|
|
|
|
|
|
|
error: aborting due to 13 previous errors
|
|
|
|
|