2017-02-07 14:05:30 -06:00
|
|
|
error: this if statement can be collapsed
|
2018-12-09 23:27:19 -06:00
|
|
|
--> $DIR/collapsible_if.rs:15:5
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-12-09 23:27:19 -06:00
|
|
|
15 | / if x == "hello" {
|
|
|
|
16 | | if y == "world" {
|
|
|
|
17 | | println!("Hello world!");
|
|
|
|
18 | | }
|
|
|
|
19 | | }
|
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
|
|
|
|
|
2018-12-09 23:27:19 -06:00
|
|
|
15 | if x == "hello" && y == "world" {
|
|
|
|
16 | println!("Hello world!");
|
|
|
|
17 | }
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
|
|
error: this if statement can be collapsed
|
2018-12-09 23:27:19 -06:00
|
|
|
--> $DIR/collapsible_if.rs:21:5
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-12-09 23:27:19 -06:00
|
|
|
21 | / if x == "hello" || x == "world" {
|
|
|
|
22 | | if y == "world" || y == "hello" {
|
|
|
|
23 | | println!("Hello world!");
|
|
|
|
24 | | }
|
|
|
|
25 | | }
|
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
|
|
|
|
|
2018-12-09 23:27:19 -06:00
|
|
|
21 | if (x == "hello" || x == "world") && (y == "world" || y == "hello") {
|
|
|
|
22 | println!("Hello world!");
|
|
|
|
23 | }
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
|
|
error: this if statement can be collapsed
|
2018-12-09 23:27:19 -06:00
|
|
|
--> $DIR/collapsible_if.rs:27:5
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-12-09 23:27:19 -06:00
|
|
|
27 | / if x == "hello" && x == "world" {
|
|
|
|
28 | | if y == "world" || y == "hello" {
|
|
|
|
29 | | println!("Hello world!");
|
|
|
|
30 | | }
|
|
|
|
31 | | }
|
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
|
|
|
|
|
2018-12-09 23:27:19 -06:00
|
|
|
27 | if x == "hello" && x == "world" && (y == "world" || y == "hello") {
|
|
|
|
28 | println!("Hello world!");
|
|
|
|
29 | }
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
|
|
error: this if statement can be collapsed
|
2018-12-09 23:27:19 -06:00
|
|
|
--> $DIR/collapsible_if.rs:33:5
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-12-09 23:27:19 -06:00
|
|
|
33 | / if x == "hello" || x == "world" {
|
|
|
|
34 | | if y == "world" && y == "hello" {
|
|
|
|
35 | | println!("Hello world!");
|
|
|
|
36 | | }
|
|
|
|
37 | | }
|
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
|
|
|
|
|
2018-12-09 23:27:19 -06:00
|
|
|
33 | if (x == "hello" || x == "world") && y == "world" && y == "hello" {
|
|
|
|
34 | println!("Hello world!");
|
|
|
|
35 | }
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
|
|
error: this if statement can be collapsed
|
2018-12-09 23:27:19 -06:00
|
|
|
--> $DIR/collapsible_if.rs:39:5
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-12-09 23:27:19 -06:00
|
|
|
39 | / if x == "hello" && x == "world" {
|
|
|
|
40 | | if y == "world" && y == "hello" {
|
|
|
|
41 | | println!("Hello world!");
|
|
|
|
42 | | }
|
|
|
|
43 | | }
|
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
|
|
|
|
|
2018-12-09 23:27:19 -06:00
|
|
|
39 | if x == "hello" && x == "world" && y == "world" && y == "hello" {
|
|
|
|
40 | println!("Hello world!");
|
|
|
|
41 | }
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
|
|
error: this if statement can be collapsed
|
2018-12-09 23:27:19 -06:00
|
|
|
--> $DIR/collapsible_if.rs:45:5
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-12-09 23:27:19 -06:00
|
|
|
45 | / if 42 == 1337 {
|
|
|
|
46 | | if 'a' != 'A' {
|
|
|
|
47 | | println!("world!")
|
|
|
|
48 | | }
|
|
|
|
49 | | }
|
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
|
|
|
|
|
2018-12-09 23:27:19 -06:00
|
|
|
45 | if 42 == 1337 && 'a' != 'A' {
|
|
|
|
46 | println!("world!")
|
|
|
|
47 | }
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
2018-12-09 23:27:19 -06:00
|
|
|
--> $DIR/collapsible_if.rs:54:12
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-12-09 23:27:19 -06:00
|
|
|
54 | } else {
|
2017-04-23 08:25:22 -05:00
|
|
|
| ____________^
|
2018-12-09 23:27:19 -06:00
|
|
|
55 | | if y == "world" {
|
|
|
|
56 | | println!("world!")
|
|
|
|
57 | | }
|
|
|
|
58 | | }
|
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
|
|
|
|
|
2018-12-09 23:27:19 -06:00
|
|
|
54 | } else if y == "world" {
|
|
|
|
55 | println!("world!")
|
|
|
|
56 | }
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
2018-12-09 23:27:19 -06:00
|
|
|
--> $DIR/collapsible_if.rs:62:12
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-12-09 23:27:19 -06:00
|
|
|
62 | } else {
|
2017-04-23 08:25:22 -05:00
|
|
|
| ____________^
|
2018-12-09 23:27:19 -06:00
|
|
|
63 | | if let Some(42) = Some(42) {
|
|
|
|
64 | | println!("world!")
|
|
|
|
65 | | }
|
|
|
|
66 | | }
|
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
|
|
|
|
|
2018-12-09 23:27:19 -06:00
|
|
|
62 | } else if let Some(42) = Some(42) {
|
|
|
|
63 | println!("world!")
|
|
|
|
64 | }
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
2018-12-09 23:27:19 -06:00
|
|
|
--> $DIR/collapsible_if.rs:70:12
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-12-09 23:27:19 -06:00
|
|
|
70 | } else {
|
2017-04-23 08:25:22 -05:00
|
|
|
| ____________^
|
2018-12-09 23:27:19 -06:00
|
|
|
71 | | if y == "world" {
|
|
|
|
72 | | println!("world")
|
|
|
|
73 | | }
|
2017-04-10 08:36:07 -05:00
|
|
|
... |
|
2018-12-09 23:27:19 -06:00
|
|
|
76 | | }
|
|
|
|
77 | | }
|
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
|
|
|
|
|
2018-12-09 23:27:19 -06:00
|
|
|
70 | } else if y == "world" {
|
|
|
|
71 | println!("world")
|
|
|
|
72 | }
|
|
|
|
73 | else {
|
|
|
|
74 | println!("!")
|
|
|
|
75 | }
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
2018-12-09 23:27:19 -06:00
|
|
|
--> $DIR/collapsible_if.rs:81:12
|
2017-05-11 05:00:31 -05:00
|
|
|
|
|
2018-12-09 23:27:19 -06:00
|
|
|
81 | } else {
|
2017-05-11 05:00:31 -05:00
|
|
|
| ____________^
|
2018-12-09 23:27:19 -06:00
|
|
|
82 | | if let Some(42) = Some(42) {
|
|
|
|
83 | | println!("world")
|
|
|
|
84 | | }
|
2017-05-11 05:00:31 -05:00
|
|
|
... |
|
2018-12-09 23:27:19 -06:00
|
|
|
87 | | }
|
|
|
|
88 | | }
|
2017-05-11 05:00:31 -05:00
|
|
|
| |_____^
|
2017-02-07 14:05:30 -06:00
|
|
|
help: try
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
2018-12-09 23:27:19 -06:00
|
|
|
81 | } else if let Some(42) = Some(42) {
|
|
|
|
82 | println!("world")
|
|
|
|
83 | }
|
|
|
|
84 | else {
|
|
|
|
85 | println!("!")
|
|
|
|
86 | }
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
2018-12-09 23:27:19 -06:00
|
|
|
--> $DIR/collapsible_if.rs:92:12
|
|
|
|
|
|
|
|
|
92 | } else {
|
|
|
|
| ____________^
|
|
|
|
93 | | if let Some(42) = Some(42) {
|
|
|
|
94 | | println!("world")
|
|
|
|
95 | | }
|
|
|
|
... |
|
|
|
|
98 | | }
|
|
|
|
99 | | }
|
|
|
|
| |_____^
|
2017-02-07 14:05:30 -06:00
|
|
|
help: try
|
2018-12-09 23:27:19 -06:00
|
|
|
|
|
|
|
|
92 | } else if let Some(42) = Some(42) {
|
|
|
|
93 | println!("world")
|
|
|
|
94 | }
|
|
|
|
95 | else {
|
|
|
|
96 | println!("!")
|
|
|
|
97 | }
|
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
2018-12-09 23:27:19 -06:00
|
|
|
--> $DIR/collapsible_if.rs:103:12
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-12-09 23:27:19 -06:00
|
|
|
103 | } else {
|
2017-04-23 08:25:22 -05:00
|
|
|
| ____________^
|
2018-12-09 23:27:19 -06:00
|
|
|
104 | | if x == "hello" {
|
|
|
|
105 | | println!("world")
|
|
|
|
106 | | }
|
2017-04-10 08:36:07 -05:00
|
|
|
... |
|
2018-12-09 23:27:19 -06:00
|
|
|
109 | | }
|
|
|
|
110 | | }
|
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
|
|
|
|
|
2018-12-09 23:27:19 -06:00
|
|
|
103 | } else if x == "hello" {
|
|
|
|
104 | println!("world")
|
|
|
|
105 | }
|
|
|
|
106 | else {
|
|
|
|
107 | println!("!")
|
|
|
|
108 | }
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
2018-12-09 23:27:19 -06:00
|
|
|
--> $DIR/collapsible_if.rs:114:12
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-12-09 23:27:19 -06:00
|
|
|
114 | } else {
|
2017-04-23 08:25:22 -05:00
|
|
|
| ____________^
|
2018-12-09 23:27:19 -06:00
|
|
|
115 | | if let Some(42) = Some(42) {
|
|
|
|
116 | | println!("world")
|
|
|
|
117 | | }
|
2017-04-10 08:36:07 -05:00
|
|
|
... |
|
2018-12-09 23:27:19 -06:00
|
|
|
120 | | }
|
|
|
|
121 | | }
|
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
|
|
|
|
|
2018-12-09 23:27:19 -06:00
|
|
|
114 | } else if let Some(42) = Some(42) {
|
|
|
|
115 | println!("world")
|
|
|
|
116 | }
|
|
|
|
117 | else {
|
|
|
|
118 | println!("!")
|
|
|
|
119 | }
|
2017-07-10 08:29:29 -05:00
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
2018-10-16 15:20:27 -05:00
|
|
|
error: this if statement can be collapsed
|
2018-12-09 23:27:19 -06:00
|
|
|
--> $DIR/collapsible_if.rs:173:5
|
2018-10-16 15:20:27 -05:00
|
|
|
|
|
2018-12-09 23:27:19 -06:00
|
|
|
173 | / if x == "hello" {
|
|
|
|
174 | | if y == "world" { // Collapsible
|
|
|
|
175 | | println!("Hello world!");
|
|
|
|
176 | | }
|
|
|
|
177 | | }
|
2018-10-16 15:20:27 -05:00
|
|
|
| |_____^
|
|
|
|
help: try
|
|
|
|
|
|
2018-12-09 23:27:19 -06:00
|
|
|
173 | if x == "hello" && y == "world" { // Collapsible
|
|
|
|
174 | println!("Hello world!");
|
|
|
|
175 | }
|
2018-10-16 15:20:27 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
error: aborting due to 14 previous errors
|
2018-01-16 10:06:27 -06:00
|
|
|
|