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