2017-02-07 20:05:30 +00:00
|
|
|
error: this if statement can be collapsed
|
2017-05-17 15:51:35 +00:00
|
|
|
--> collapsible_if.rs:8:5
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2017-04-23 13:25:22 +00:00
|
|
|
8 | / if x == "hello" {
|
2017-05-11 10:00:31 +00:00
|
|
|
9 | | if y == "world" {
|
|
|
|
10 | | println!("Hello world!");
|
|
|
|
11 | | }
|
|
|
|
12 | | }
|
2017-04-23 13:25:22 +00:00
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2017-05-17 12:19:44 +00:00
|
|
|
= note: `-D collapsible-if` implied by `-D warnings`
|
2017-02-07 20:05:30 +00:00
|
|
|
help: try
|
|
|
|
| if x == "hello" && y == "world" {
|
|
|
|
| println!("Hello world!");
|
|
|
|
| }
|
|
|
|
|
|
|
|
error: this if statement can be collapsed
|
2017-05-17 15:51:35 +00:00
|
|
|
--> collapsible_if.rs:14:5
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2017-05-11 10:00:31 +00:00
|
|
|
14 | / if x == "hello" || x == "world" {
|
|
|
|
15 | | if y == "world" || y == "hello" {
|
|
|
|
16 | | println!("Hello world!");
|
|
|
|
17 | | }
|
|
|
|
18 | | }
|
2017-04-23 13:25:22 +00:00
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2017-05-17 12:19:44 +00:00
|
|
|
= note: `-D collapsible-if` implied by `-D warnings`
|
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
|
2017-05-17 15:51:35 +00:00
|
|
|
--> collapsible_if.rs:20:5
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2017-05-11 10:00:31 +00:00
|
|
|
20 | / if x == "hello" && x == "world" {
|
|
|
|
21 | | if y == "world" || y == "hello" {
|
|
|
|
22 | | println!("Hello world!");
|
|
|
|
23 | | }
|
|
|
|
24 | | }
|
2017-04-23 13:25:22 +00:00
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2017-05-17 12:19:44 +00:00
|
|
|
= note: `-D collapsible-if` implied by `-D warnings`
|
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
|
2017-05-17 15:51:35 +00:00
|
|
|
--> collapsible_if.rs:26:5
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2017-05-11 10:00:31 +00:00
|
|
|
26 | / if x == "hello" || x == "world" {
|
|
|
|
27 | | if y == "world" && y == "hello" {
|
|
|
|
28 | | println!("Hello world!");
|
|
|
|
29 | | }
|
|
|
|
30 | | }
|
2017-04-23 13:25:22 +00:00
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2017-05-17 12:19:44 +00:00
|
|
|
= note: `-D collapsible-if` implied by `-D warnings`
|
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
|
2017-05-17 15:51:35 +00:00
|
|
|
--> collapsible_if.rs:32:5
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2017-05-11 10:00:31 +00:00
|
|
|
32 | / if x == "hello" && x == "world" {
|
|
|
|
33 | | if y == "world" && y == "hello" {
|
|
|
|
34 | | println!("Hello world!");
|
|
|
|
35 | | }
|
|
|
|
36 | | }
|
2017-04-23 13:25:22 +00:00
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2017-05-17 12:19:44 +00:00
|
|
|
= note: `-D collapsible-if` implied by `-D warnings`
|
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
|
2017-05-17 15:51:35 +00:00
|
|
|
--> collapsible_if.rs:38:5
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2017-05-11 10:00:31 +00:00
|
|
|
38 | / if 42 == 1337 {
|
|
|
|
39 | | if 'a' != 'A' {
|
|
|
|
40 | | println!("world!")
|
|
|
|
41 | | }
|
|
|
|
42 | | }
|
2017-04-23 13:25:22 +00:00
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2017-05-17 12:19:44 +00:00
|
|
|
= note: `-D collapsible-if` implied by `-D warnings`
|
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
|
2017-05-17 15:51:35 +00:00
|
|
|
--> collapsible_if.rs:47:12
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2017-05-11 10:00:31 +00:00
|
|
|
47 | } else {
|
2017-04-23 13:25:22 +00:00
|
|
|
| ____________^
|
2017-05-11 10:00:31 +00:00
|
|
|
48 | | if y == "world" {
|
|
|
|
49 | | println!("world!")
|
|
|
|
50 | | }
|
|
|
|
51 | | }
|
2017-04-23 13:25:22 +00:00
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2017-05-17 12:19:44 +00:00
|
|
|
= note: `-D collapsible-if` implied by `-D warnings`
|
2017-02-07 20:05:30 +00:00
|
|
|
help: try
|
|
|
|
| } else if y == "world" {
|
|
|
|
| println!("world!")
|
|
|
|
| }
|
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
2017-05-17 15:51:35 +00:00
|
|
|
--> collapsible_if.rs:55:12
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2017-05-11 10:00:31 +00:00
|
|
|
55 | } else {
|
2017-04-23 13:25:22 +00:00
|
|
|
| ____________^
|
2017-05-11 10:00:31 +00:00
|
|
|
56 | | if let Some(42) = Some(42) {
|
|
|
|
57 | | println!("world!")
|
|
|
|
58 | | }
|
|
|
|
59 | | }
|
2017-04-23 13:25:22 +00:00
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2017-05-17 12:19:44 +00:00
|
|
|
= note: `-D collapsible-if` implied by `-D warnings`
|
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
|
2017-05-17 15:51:35 +00:00
|
|
|
--> collapsible_if.rs:63:12
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2017-05-11 10:00:31 +00:00
|
|
|
63 | } else {
|
2017-04-23 13:25:22 +00:00
|
|
|
| ____________^
|
2017-05-11 10:00:31 +00:00
|
|
|
64 | | if y == "world" {
|
|
|
|
65 | | println!("world")
|
|
|
|
66 | | }
|
2017-04-10 13:36:07 +00:00
|
|
|
... |
|
2017-05-11 10:00:31 +00:00
|
|
|
69 | | }
|
|
|
|
70 | | }
|
2017-04-23 13:25:22 +00:00
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2017-05-17 12:19:44 +00:00
|
|
|
= note: `-D collapsible-if` implied by `-D warnings`
|
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
|
2017-05-17 15:51:35 +00:00
|
|
|
--> collapsible_if.rs:74:12
|
2017-05-11 10:00:31 +00:00
|
|
|
|
|
|
|
|
74 | } else {
|
|
|
|
| ____________^
|
|
|
|
75 | | if let Some(42) = Some(42) {
|
|
|
|
76 | | println!("world")
|
|
|
|
77 | | }
|
|
|
|
... |
|
|
|
|
80 | | }
|
|
|
|
81 | | }
|
|
|
|
| |_____^
|
|
|
|
|
|
2017-05-17 12:19:44 +00:00
|
|
|
= note: `-D collapsible-if` implied by `-D warnings`
|
2017-02-07 20:05:30 +00:00
|
|
|
help: try
|
2017-05-11 10:00:31 +00:00
|
|
|
| } else if let Some(42) = Some(42) {
|
|
|
|
| println!("world")
|
|
|
|
| }
|
|
|
|
| else {
|
|
|
|
| println!("!")
|
|
|
|
| }
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
2017-05-17 15:51:35 +00:00
|
|
|
--> collapsible_if.rs:85:12
|
2017-05-11 10:00:31 +00:00
|
|
|
|
|
|
|
|
85 | } else {
|
|
|
|
| ____________^
|
|
|
|
86 | | if let Some(42) = Some(42) {
|
|
|
|
87 | | println!("world")
|
|
|
|
88 | | }
|
|
|
|
... |
|
|
|
|
91 | | }
|
|
|
|
92 | | }
|
|
|
|
| |_____^
|
|
|
|
|
|
2017-05-17 12:19:44 +00:00
|
|
|
= note: `-D collapsible-if` implied by `-D warnings`
|
2017-02-07 20:05:30 +00:00
|
|
|
help: try
|
2017-05-11 10:00:31 +00:00
|
|
|
| } else if let Some(42) = Some(42) {
|
|
|
|
| println!("world")
|
|
|
|
| }
|
|
|
|
| else {
|
|
|
|
| println!("!")
|
|
|
|
| }
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
2017-05-17 15:51:35 +00:00
|
|
|
--> collapsible_if.rs:96:12
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2017-05-11 10:00:31 +00:00
|
|
|
96 | } else {
|
2017-04-23 13:25:22 +00:00
|
|
|
| ____________^
|
2017-05-11 10:00:31 +00:00
|
|
|
97 | | if x == "hello" {
|
|
|
|
98 | | println!("world")
|
|
|
|
99 | | }
|
2017-04-10 13:36:07 +00:00
|
|
|
... |
|
2017-05-11 10:00:31 +00:00
|
|
|
102 | | }
|
|
|
|
103 | | }
|
2017-04-23 13:25:22 +00:00
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2017-05-17 12:19:44 +00:00
|
|
|
= note: `-D collapsible-if` implied by `-D warnings`
|
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
|
2017-05-17 15:51:35 +00:00
|
|
|
--> collapsible_if.rs:107:12
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2017-05-11 10:00:31 +00:00
|
|
|
107 | } else {
|
2017-04-23 13:25:22 +00:00
|
|
|
| ____________^
|
2017-05-11 10:00:31 +00:00
|
|
|
108 | | if let Some(42) = Some(42) {
|
|
|
|
109 | | println!("world")
|
|
|
|
110 | | }
|
2017-04-10 13:36:07 +00:00
|
|
|
... |
|
2017-05-11 10:00:31 +00:00
|
|
|
113 | | }
|
|
|
|
114 | | }
|
2017-04-23 13:25:22 +00:00
|
|
|
| |_____^
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2017-05-17 12:19:44 +00:00
|
|
|
= note: `-D collapsible-if` implied by `-D warnings`
|
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
|
|
|
|
|
2017-05-17 12:19:44 +00:00
|
|
|
error: Could not compile `clippy_tests`.
|
|
|
|
|
|
|
|
To learn more, run the command again with --verbose.
|