]> git.lizzy.rs Git - rust.git/blob - tests/ui/collapsible_if.stderr
Merge pull request #1520 from Manishearth/rustup
[rust.git] / tests / ui / collapsible_if.stderr
1 error: this if statement can be collapsed
2   --> $DIR/collapsible_if.rs:8:5
3    |
4 8  |       if x == "hello" {
5    |  _____^ starting here...
6 9  | |
7 10 | |
8 11 | |
9 12 | |         if y == "world" {
10 13 | |             println!("Hello world!");
11 14 | |         }
12 15 | |     }
13    | |_____^ ...ending here
14    |
15 note: lint level defined here
16   --> $DIR/collapsible_if.rs:4:8
17    |
18 4  | #[deny(collapsible_if)]
19    |        ^^^^^^^^^^^^^^
20 help: try
21    |     if x == "hello" && y == "world" {
22    |     println!("Hello world!");
23    | }
24
25 error: this if statement can be collapsed
26   --> $DIR/collapsible_if.rs:17:5
27    |
28 17 |       if x == "hello" || x == "world" {
29    |  _____^ starting here...
30 18 | |
31 19 | |
32 20 | |
33 21 | |         if y == "world" || y == "hello" {
34 22 | |             println!("Hello world!");
35 23 | |         }
36 24 | |     }
37    | |_____^ ...ending here
38    |
39 help: try
40    |     if (x == "hello" || x == "world") && (y == "world" || y == "hello") {
41    |     println!("Hello world!");
42    | }
43
44 error: this if statement can be collapsed
45   --> $DIR/collapsible_if.rs:26:5
46    |
47 26 |       if x == "hello" && x == "world" {
48    |  _____^ starting here...
49 27 | |
50 28 | |
51 29 | |
52 30 | |         if y == "world" || y == "hello" {
53 31 | |             println!("Hello world!");
54 32 | |         }
55 33 | |     }
56    | |_____^ ...ending here
57    |
58 help: try
59    |     if x == "hello" && x == "world" && (y == "world" || y == "hello") {
60    |     println!("Hello world!");
61    | }
62
63 error: this if statement can be collapsed
64   --> $DIR/collapsible_if.rs:35:5
65    |
66 35 |       if x == "hello" || x == "world" {
67    |  _____^ starting here...
68 36 | |
69 37 | |
70 38 | |
71 39 | |         if y == "world" && y == "hello" {
72 40 | |             println!("Hello world!");
73 41 | |         }
74 42 | |     }
75    | |_____^ ...ending here
76    |
77 help: try
78    |     if (x == "hello" || x == "world") && y == "world" && y == "hello" {
79    |     println!("Hello world!");
80    | }
81
82 error: this if statement can be collapsed
83   --> $DIR/collapsible_if.rs:44:5
84    |
85 44 |       if x == "hello" && x == "world" {
86    |  _____^ starting here...
87 45 | |
88 46 | |
89 47 | |
90 48 | |         if y == "world" && y == "hello" {
91 49 | |             println!("Hello world!");
92 50 | |         }
93 51 | |     }
94    | |_____^ ...ending here
95    |
96 help: try
97    |     if x == "hello" && x == "world" && y == "world" && y == "hello" {
98    |     println!("Hello world!");
99    | }
100
101 error: this if statement can be collapsed
102   --> $DIR/collapsible_if.rs:53:5
103    |
104 53 |       if 42 == 1337 {
105    |  _____^ starting here...
106 54 | |
107 55 | |
108 56 | |
109 57 | |         if 'a' != 'A' {
110 58 | |             println!("world!")
111 59 | |         }
112 60 | |     }
113    | |_____^ ...ending here
114    |
115 help: try
116    |     if 42 == 1337 && 'a' != 'A' {
117    |     println!("world!")
118    | }
119
120 error: this `else { if .. }` block can be collapsed
121   --> $DIR/collapsible_if.rs:65:12
122    |
123 65 |       } else {
124    |  ____________^ starting here...
125 66 | |
126 67 | |
127 68 | |
128 69 | |         if y == "world" {
129 70 | |             println!("world!")
130 71 | |         }
131 72 | |     }
132    | |_____^ ...ending here
133    |
134 help: try
135    |     } else if y == "world" {
136    |     println!("world!")
137    | }
138
139 error: this `else { if .. }` block can be collapsed
140   --> $DIR/collapsible_if.rs:76:12
141    |
142 76 |       } else {
143    |  ____________^ starting here...
144 77 | |
145 78 | |
146 79 | |
147 80 | |         if let Some(42) = Some(42) {
148 81 | |             println!("world!")
149 82 | |         }
150 83 | |     }
151    | |_____^ ...ending here
152    |
153 help: try
154    |     } else if let Some(42) = Some(42) {
155    |     println!("world!")
156    | }
157
158 error: this `else { if .. }` block can be collapsed
159   --> $DIR/collapsible_if.rs:87:12
160    |
161 87 |     } else {
162    |            ^
163    |
164 help: try
165    |     } else if y == "world" {
166    |     println!("world")
167    | }
168    | else {
169    |     println!("!")
170    | }
171
172 error: this `else { if .. }` block can be collapsed
173    --> $DIR/collapsible_if.rs:101:12
174     |
175 101 |     } else {
176     |            ^
177     |
178 help: try
179     |     } else if let Some(42) = Some(42) {
180     |     println!("world")
181     | }
182     | else {
183     |     println!("!")
184     | }
185
186 error: this `else { if .. }` block can be collapsed
187    --> $DIR/collapsible_if.rs:115:12
188     |
189 115 |     } else {
190     |            ^
191     |
192 help: try
193     |     } else if let Some(42) = Some(42) {
194     |     println!("world")
195     | }
196     | else {
197     |     println!("!")
198     | }
199
200 error: this `else { if .. }` block can be collapsed
201    --> $DIR/collapsible_if.rs:129:12
202     |
203 129 |     } else {
204     |            ^
205     |
206 help: try
207     |     } else if x == "hello" {
208     |     println!("world")
209     | }
210     | else {
211     |     println!("!")
212     | }
213
214 error: this `else { if .. }` block can be collapsed
215    --> $DIR/collapsible_if.rs:143:12
216     |
217 143 |     } else {
218     |            ^
219     |
220 help: try
221     |     } else if let Some(42) = Some(42) {
222     |     println!("world")
223     | }
224     | else {
225     |     println!("!")
226     | }
227
228 error: aborting due to 13 previous errors
229