rust-clippy/tests/ui/collapsible_if.stderr

245 lines
5.1 KiB
Text
Raw Normal View History

error: this if statement can be collapsed
2018-10-06 16:18:06 +00:00
--> $DIR/collapsible_if.rs:18:5
|
2018-10-06 16:18:06 +00:00
18 | / if x == "hello" {
19 | | if y == "world" {
20 | | println!("Hello world!");
21 | | }
22 | | }
| |_____^
|
= note: `-D clippy::collapsible-if` implied by `-D warnings`
help: try
2017-07-10 13:29:29 +00:00
|
2018-10-06 16:18:06 +00:00
18 | if x == "hello" && y == "world" {
19 | println!("Hello world!");
20 | }
2017-07-10 13:29:29 +00:00
|
error: this if statement can be collapsed
2018-10-06 16:18:06 +00:00
--> $DIR/collapsible_if.rs:24:5
|
2018-10-06 16:18:06 +00:00
24 | / if x == "hello" || x == "world" {
25 | | if y == "world" || y == "hello" {
26 | | println!("Hello world!");
27 | | }
28 | | }
| |_____^
help: try
2017-07-10 13:29:29 +00:00
|
2018-10-06 16:18:06 +00:00
24 | if (x == "hello" || x == "world") && (y == "world" || y == "hello") {
25 | println!("Hello world!");
26 | }
2017-07-10 13:29:29 +00:00
|
error: this if statement can be collapsed
2018-10-06 16:18:06 +00:00
--> $DIR/collapsible_if.rs:30:5
|
2018-10-06 16:18:06 +00:00
30 | / if x == "hello" && x == "world" {
31 | | if y == "world" || y == "hello" {
32 | | println!("Hello world!");
33 | | }
34 | | }
| |_____^
help: try
2017-07-10 13:29:29 +00:00
|
2018-10-06 16:18:06 +00:00
30 | if x == "hello" && x == "world" && (y == "world" || y == "hello") {
31 | println!("Hello world!");
32 | }
2017-07-10 13:29:29 +00:00
|
error: this if statement can be collapsed
2018-10-06 16:18:06 +00:00
--> $DIR/collapsible_if.rs:36:5
|
2018-10-06 16:18:06 +00:00
36 | / if x == "hello" || x == "world" {
37 | | if y == "world" && y == "hello" {
38 | | println!("Hello world!");
39 | | }
40 | | }
| |_____^
help: try
2017-07-10 13:29:29 +00:00
|
2018-10-06 16:18:06 +00:00
36 | if (x == "hello" || x == "world") && y == "world" && y == "hello" {
37 | println!("Hello world!");
38 | }
2017-07-10 13:29:29 +00:00
|
error: this if statement can be collapsed
2018-10-06 16:18:06 +00:00
--> $DIR/collapsible_if.rs:42:5
|
2018-10-06 16:18:06 +00:00
42 | / if x == "hello" && x == "world" {
43 | | if y == "world" && y == "hello" {
44 | | println!("Hello world!");
45 | | }
46 | | }
| |_____^
help: try
2017-07-10 13:29:29 +00:00
|
2018-10-06 16:18:06 +00:00
42 | if x == "hello" && x == "world" && y == "world" && y == "hello" {
43 | println!("Hello world!");
44 | }
2017-07-10 13:29:29 +00:00
|
error: this if statement can be collapsed
2018-10-06 16:18:06 +00:00
--> $DIR/collapsible_if.rs:48:5
|
2018-10-06 16:18:06 +00:00
48 | / if 42 == 1337 {
49 | | if 'a' != 'A' {
50 | | println!("world!")
51 | | }
52 | | }
| |_____^
help: try
2017-07-10 13:29:29 +00:00
|
2018-10-06 16:18:06 +00:00
48 | if 42 == 1337 && 'a' != 'A' {
49 | println!("world!")
50 | }
2017-07-10 13:29:29 +00:00
|
error: this `else { if .. }` block can be collapsed
2018-10-06 16:18:06 +00:00
--> $DIR/collapsible_if.rs:57:12
|
2018-10-06 16:18:06 +00:00
57 | } else {
| ____________^
2018-10-06 16:18:06 +00:00
58 | | if y == "world" {
59 | | println!("world!")
60 | | }
61 | | }
| |_____^
help: try
2017-07-10 13:29:29 +00:00
|
2018-10-06 16:18:06 +00:00
57 | } else if y == "world" {
58 | println!("world!")
59 | }
2017-07-10 13:29:29 +00:00
|
error: this `else { if .. }` block can be collapsed
2018-10-06 16:18:06 +00:00
--> $DIR/collapsible_if.rs:65:12
|
2018-10-06 16:18:06 +00:00
65 | } else {
| ____________^
2018-10-06 16:18:06 +00:00
66 | | if let Some(42) = Some(42) {
67 | | println!("world!")
68 | | }
69 | | }
| |_____^
help: try
2017-07-10 13:29:29 +00:00
|
2018-10-06 16:18:06 +00:00
65 | } else if let Some(42) = Some(42) {
66 | println!("world!")
67 | }
2017-07-10 13:29:29 +00:00
|
error: this `else { if .. }` block can be collapsed
2018-10-06 16:18:06 +00:00
--> $DIR/collapsible_if.rs:73:12
|
2018-10-06 16:18:06 +00:00
73 | } else {
| ____________^
2018-10-06 16:18:06 +00:00
74 | | if y == "world" {
75 | | println!("world")
76 | | }
... |
2018-10-06 16:18:06 +00:00
79 | | }
80 | | }
| |_____^
help: try
2017-07-10 13:29:29 +00:00
|
2018-10-06 16:18:06 +00:00
73 | } else if y == "world" {
74 | println!("world")
75 | }
76 | else {
77 | println!("!")
78 | }
2017-07-10 13:29:29 +00:00
|
error: this `else { if .. }` block can be collapsed
2018-10-06 16:18:06 +00:00
--> $DIR/collapsible_if.rs:84:12
|
2018-10-06 16:18:06 +00:00
84 | } else {
| ____________^
2018-10-06 16:18:06 +00:00
85 | | if let Some(42) = Some(42) {
86 | | println!("world")
87 | | }
... |
2018-10-06 16:18:06 +00:00
90 | | }
91 | | }
| |_____^
help: try
2017-07-10 13:29:29 +00:00
|
2018-10-06 16:18:06 +00:00
84 | } else if let Some(42) = Some(42) {
85 | println!("world")
86 | }
87 | else {
88 | println!("!")
89 | }
2017-07-10 13:29:29 +00:00
|
error: this `else { if .. }` block can be collapsed
2018-10-06 16:18:06 +00:00
--> $DIR/collapsible_if.rs:95:12
|
95 | } else {
| ____________^
96 | | if let Some(42) = Some(42) {
97 | | println!("world")
98 | | }
... |
101 | | }
102 | | }
| |_____^
help: try
2018-10-06 16:18:06 +00:00
|
95 | } else if let Some(42) = Some(42) {
96 | println!("world")
97 | }
98 | else {
99 | println!("!")
100 | }
|
error: this `else { if .. }` block can be collapsed
2018-10-06 16:18:06 +00:00
--> $DIR/collapsible_if.rs:106:12
|
2018-10-06 16:18:06 +00:00
106 | } else {
| ____________^
2018-10-06 16:18:06 +00:00
107 | | if x == "hello" {
108 | | println!("world")
109 | | }
... |
2018-10-06 16:18:06 +00:00
112 | | }
113 | | }
| |_____^
help: try
2017-07-10 13:29:29 +00:00
|
2018-10-06 16:18:06 +00:00
106 | } else if x == "hello" {
107 | println!("world")
108 | }
109 | else {
110 | println!("!")
111 | }
2017-07-10 13:29:29 +00:00
|
error: this `else { if .. }` block can be collapsed
2018-10-06 16:18:06 +00:00
--> $DIR/collapsible_if.rs:117:12
|
2018-10-06 16:18:06 +00:00
117 | } else {
| ____________^
2018-10-06 16:18:06 +00:00
118 | | if let Some(42) = Some(42) {
119 | | println!("world")
120 | | }
... |
2018-10-06 16:18:06 +00:00
123 | | }
124 | | }
| |_____^
help: try
2017-07-10 13:29:29 +00:00
|
2018-10-06 16:18:06 +00:00
117 | } else if let Some(42) = Some(42) {
118 | println!("world")
119 | }
120 | else {
121 | println!("!")
122 | }
2017-07-10 13:29:29 +00:00
|
2018-01-16 16:06:27 +00:00
error: aborting due to 13 previous errors