]> git.lizzy.rs Git - rust.git/blob - tests/ui/for_loop.stderr
Merge branch 'master' into add-lints-aseert-checks
[rust.git] / tests / ui / for_loop.stderr
1 error: the loop variable `i` is only used to index `vec`.
2   --> $DIR/for_loop.rs:41:14
3    |
4 LL |     for i in 0..vec.len() {
5    |              ^^^^^^^^^^^^
6    |
7    = note: `-D clippy::needless-range-loop` implied by `-D warnings`
8 help: consider using an iterator
9    |
10 LL |     for <item> in &vec {
11    |         ^^^^^^    ^^^^
12
13 error: the loop variable `i` is only used to index `vec`.
14   --> $DIR/for_loop.rs:50:14
15    |
16 LL |     for i in 0..vec.len() {
17    |              ^^^^^^^^^^^^
18 help: consider using an iterator
19    |
20 LL |     for <item> in &vec {
21    |         ^^^^^^    ^^^^
22
23 error: the loop variable `j` is only used to index `STATIC`.
24   --> $DIR/for_loop.rs:55:14
25    |
26 LL |     for j in 0..4 {
27    |              ^^^^
28 help: consider using an iterator
29    |
30 LL |     for <item> in &STATIC {
31    |         ^^^^^^    ^^^^^^^
32
33 error: the loop variable `j` is only used to index `CONST`.
34   --> $DIR/for_loop.rs:59:14
35    |
36 LL |     for j in 0..4 {
37    |              ^^^^
38 help: consider using an iterator
39    |
40 LL |     for <item> in &CONST {
41    |         ^^^^^^    ^^^^^^
42
43 error: the loop variable `i` is used to index `vec`
44   --> $DIR/for_loop.rs:63:14
45    |
46 LL |     for i in 0..vec.len() {
47    |              ^^^^^^^^^^^^
48 help: consider using an iterator
49    |
50 LL |     for (i, <item>) in vec.iter().enumerate() {
51    |         ^^^^^^^^^^^    ^^^^^^^^^^^^^^^^^^^^^^
52
53 error: the loop variable `i` is only used to index `vec2`.
54   --> $DIR/for_loop.rs:71:14
55    |
56 LL |     for i in 0..vec.len() {
57    |              ^^^^^^^^^^^^
58 help: consider using an iterator
59    |
60 LL |     for <item> in vec2.iter().take(vec.len()) {
61    |         ^^^^^^    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
62
63 error: the loop variable `i` is only used to index `vec`.
64   --> $DIR/for_loop.rs:75:14
65    |
66 LL |     for i in 5..vec.len() {
67    |              ^^^^^^^^^^^^
68 help: consider using an iterator
69    |
70 LL |     for <item> in vec.iter().skip(5) {
71    |         ^^^^^^    ^^^^^^^^^^^^^^^^^^
72
73 error: the loop variable `i` is only used to index `vec`.
74   --> $DIR/for_loop.rs:79:14
75    |
76 LL |     for i in 0..MAX_LEN {
77    |              ^^^^^^^^^^
78 help: consider using an iterator
79    |
80 LL |     for <item> in vec.iter().take(MAX_LEN) {
81    |         ^^^^^^    ^^^^^^^^^^^^^^^^^^^^^^^^
82
83 error: the loop variable `i` is only used to index `vec`.
84   --> $DIR/for_loop.rs:83:14
85    |
86 LL |     for i in 0..=MAX_LEN {
87    |              ^^^^^^^^^^^
88 help: consider using an iterator
89    |
90 LL |     for <item> in vec.iter().take(MAX_LEN + 1) {
91    |         ^^^^^^    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
92
93 error: the loop variable `i` is only used to index `vec`.
94   --> $DIR/for_loop.rs:87:14
95    |
96 LL |     for i in 5..10 {
97    |              ^^^^^
98 help: consider using an iterator
99    |
100 LL |     for <item> in vec.iter().take(10).skip(5) {
101    |         ^^^^^^    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
102
103 error: the loop variable `i` is only used to index `vec`.
104   --> $DIR/for_loop.rs:91:14
105    |
106 LL |     for i in 5..=10 {
107    |              ^^^^^^
108 help: consider using an iterator
109    |
110 LL |     for <item> in vec.iter().take(10 + 1).skip(5) {
111    |         ^^^^^^    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
112
113 error: the loop variable `i` is used to index `vec`
114   --> $DIR/for_loop.rs:95:14
115    |
116 LL |     for i in 5..vec.len() {
117    |              ^^^^^^^^^^^^
118 help: consider using an iterator
119    |
120 LL |     for (i, <item>) in vec.iter().enumerate().skip(5) {
121    |         ^^^^^^^^^^^    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
122
123 error: the loop variable `i` is used to index `vec`
124   --> $DIR/for_loop.rs:99:14
125    |
126 LL |     for i in 5..10 {
127    |              ^^^^^
128 help: consider using an iterator
129    |
130 LL |     for (i, <item>) in vec.iter().enumerate().take(10).skip(5) {
131    |         ^^^^^^^^^^^    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
132
133 error: this range is empty so this for loop will never run
134   --> $DIR/for_loop.rs:103:14
135    |
136 LL |     for i in 10..0 {
137    |              ^^^^^
138    |
139    = note: `-D clippy::reverse-range-loop` implied by `-D warnings`
140 help: consider using the following if you are attempting to iterate over this range in reverse
141    |
142 LL |     for i in (0..10).rev() {
143    |              ^^^^^^^^^^^^^
144
145 error: this range is empty so this for loop will never run
146   --> $DIR/for_loop.rs:107:14
147    |
148 LL |     for i in 10..=0 {
149    |              ^^^^^^
150 help: consider using the following if you are attempting to iterate over this range in reverse
151    |
152 LL |     for i in (0...10).rev() {
153    |              ^^^^^^^^^^^^^^
154
155 error: this range is empty so this for loop will never run
156   --> $DIR/for_loop.rs:111:14
157    |
158 LL |     for i in MAX_LEN..0 {
159    |              ^^^^^^^^^^
160 help: consider using the following if you are attempting to iterate over this range in reverse
161    |
162 LL |     for i in (0..MAX_LEN).rev() {
163    |              ^^^^^^^^^^^^^^^^^^
164
165 error: this range is empty so this for loop will never run
166   --> $DIR/for_loop.rs:115:14
167    |
168 LL |     for i in 5..5 {
169    |              ^^^^
170
171 error: this range is empty so this for loop will never run
172   --> $DIR/for_loop.rs:140:14
173    |
174 LL |     for i in 10..5 + 4 {
175    |              ^^^^^^^^^
176 help: consider using the following if you are attempting to iterate over this range in reverse
177    |
178 LL |     for i in (5 + 4..10).rev() {
179    |              ^^^^^^^^^^^^^^^^^
180
181 error: this range is empty so this for loop will never run
182   --> $DIR/for_loop.rs:144:14
183    |
184 LL |     for i in (5 + 2)..(3 - 1) {
185    |              ^^^^^^^^^^^^^^^^
186 help: consider using the following if you are attempting to iterate over this range in reverse
187    |
188 LL |     for i in ((3 - 1)..(5 + 2)).rev() {
189    |              ^^^^^^^^^^^^^^^^^^^^^^^^
190
191 error: this range is empty so this for loop will never run
192   --> $DIR/for_loop.rs:148:14
193    |
194 LL |     for i in (5 + 2)..(8 - 1) {
195    |              ^^^^^^^^^^^^^^^^
196
197 error: it is more concise to loop over references to containers instead of using explicit iteration methods
198   --> $DIR/for_loop.rs:170:15
199    |
200 LL |     for _v in vec.iter() {}
201    |               ^^^^^^^^^^ help: to write this more concisely, try: `&vec`
202    |
203    = note: `-D clippy::explicit-iter-loop` implied by `-D warnings`
204
205 error: it is more concise to loop over references to containers instead of using explicit iteration methods
206   --> $DIR/for_loop.rs:172:15
207    |
208 LL |     for _v in vec.iter_mut() {}
209    |               ^^^^^^^^^^^^^^ help: to write this more concisely, try: `&mut vec`
210
211 error: it is more concise to loop over containers instead of using explicit iteration methods`
212   --> $DIR/for_loop.rs:175:15
213    |
214 LL |     for _v in out_vec.into_iter() {}
215    |               ^^^^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `out_vec`
216    |
217    = note: `-D clippy::explicit-into-iter-loop` implied by `-D warnings`
218
219 error: it is more concise to loop over references to containers instead of using explicit iteration methods
220   --> $DIR/for_loop.rs:178:15
221    |
222 LL |     for _v in array.into_iter() {}
223    |               ^^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `&array`
224
225 error: it is more concise to loop over references to containers instead of using explicit iteration methods
226   --> $DIR/for_loop.rs:183:15
227    |
228 LL |     for _v in [1, 2, 3].iter() {}
229    |               ^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `&[1, 2, 3]`
230
231 error: it is more concise to loop over references to containers instead of using explicit iteration methods
232   --> $DIR/for_loop.rs:187:15
233    |
234 LL |     for _v in [0; 32].iter() {}
235    |               ^^^^^^^^^^^^^^ help: to write this more concisely, try: `&[0; 32]`
236
237 error: it is more concise to loop over references to containers instead of using explicit iteration methods
238   --> $DIR/for_loop.rs:192:15
239    |
240 LL |     for _v in ll.iter() {}
241    |               ^^^^^^^^^ help: to write this more concisely, try: `&ll`
242
243 error: it is more concise to loop over references to containers instead of using explicit iteration methods
244   --> $DIR/for_loop.rs:195:15
245    |
246 LL |     for _v in vd.iter() {}
247    |               ^^^^^^^^^ help: to write this more concisely, try: `&vd`
248
249 error: it is more concise to loop over references to containers instead of using explicit iteration methods
250   --> $DIR/for_loop.rs:198:15
251    |
252 LL |     for _v in bh.iter() {}
253    |               ^^^^^^^^^ help: to write this more concisely, try: `&bh`
254
255 error: it is more concise to loop over references to containers instead of using explicit iteration methods
256   --> $DIR/for_loop.rs:201:15
257    |
258 LL |     for _v in hm.iter() {}
259    |               ^^^^^^^^^ help: to write this more concisely, try: `&hm`
260
261 error: it is more concise to loop over references to containers instead of using explicit iteration methods
262   --> $DIR/for_loop.rs:204:15
263    |
264 LL |     for _v in bt.iter() {}
265    |               ^^^^^^^^^ help: to write this more concisely, try: `&bt`
266
267 error: it is more concise to loop over references to containers instead of using explicit iteration methods
268   --> $DIR/for_loop.rs:207:15
269    |
270 LL |     for _v in hs.iter() {}
271    |               ^^^^^^^^^ help: to write this more concisely, try: `&hs`
272
273 error: it is more concise to loop over references to containers instead of using explicit iteration methods
274   --> $DIR/for_loop.rs:210:15
275    |
276 LL |     for _v in bs.iter() {}
277    |               ^^^^^^^^^ help: to write this more concisely, try: `&bs`
278
279 error: you are iterating over `Iterator::next()` which is an Option; this will compile but is probably not what you want
280   --> $DIR/for_loop.rs:212:15
281    |
282 LL |     for _v in vec.iter().next() {}
283    |               ^^^^^^^^^^^^^^^^^
284    |
285    = note: `-D clippy::iter-next-loop` implied by `-D warnings`
286
287 error: you are collect()ing an iterator and throwing away the result. Consider using an explicit for loop to exhaust the iterator
288   --> $DIR/for_loop.rs:219:5
289    |
290 LL |     vec.iter().cloned().map(|x| out.push(x)).collect::<Vec<_>>();
291    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
292    |
293    = note: `-D clippy::unused-collect` implied by `-D warnings`
294
295 error: it looks like you're manually copying between slices
296   --> $DIR/for_loop.rs:363:14
297    |
298 LL |     for i in 0..src.len() {
299    |              ^^^^^^^^^^^^ help: try replacing the loop by: `dst[..src.len()].clone_from_slice(&src[..])`
300    |
301    = note: `-D clippy::manual-memcpy` implied by `-D warnings`
302
303 error: it looks like you're manually copying between slices
304   --> $DIR/for_loop.rs:368:14
305    |
306 LL |     for i in 0..src.len() {
307    |              ^^^^^^^^^^^^ help: try replacing the loop by: `dst[10..(src.len() + 10)].clone_from_slice(&src[..])`
308
309 error: it looks like you're manually copying between slices
310   --> $DIR/for_loop.rs:373:14
311    |
312 LL |     for i in 0..src.len() {
313    |              ^^^^^^^^^^^^ help: try replacing the loop by: `dst[..src.len()].clone_from_slice(&src[10..])`
314
315 error: it looks like you're manually copying between slices
316   --> $DIR/for_loop.rs:378:14
317    |
318 LL |     for i in 11..src.len() {
319    |              ^^^^^^^^^^^^^ help: try replacing the loop by: `dst[11..src.len()].clone_from_slice(&src[(11 - 10)..(src.len() - 10)])`
320
321 error: it looks like you're manually copying between slices
322   --> $DIR/for_loop.rs:383:14
323    |
324 LL |     for i in 0..dst.len() {
325    |              ^^^^^^^^^^^^ help: try replacing the loop by: `dst.clone_from_slice(&src[..dst.len()])`
326
327 error: it looks like you're manually copying between slices
328   --> $DIR/for_loop.rs:396:14
329    |
330 LL |     for i in 10..256 {
331    |              ^^^^^^^
332 help: try replacing the loop by
333    |
334 LL |     for i in dst[10..256].clone_from_slice(&src[(10 - 5)..(256 - 5)])
335 LL |     dst2[(10 + 500)..(256 + 500)].clone_from_slice(&src[10..256]) {
336    |
337
338 error: it looks like you're manually copying between slices
339   --> $DIR/for_loop.rs:408:14
340    |
341 LL |     for i in 10..LOOP_OFFSET {
342    |              ^^^^^^^^^^^^^^^ help: try replacing the loop by: `dst[(10 + LOOP_OFFSET)..(LOOP_OFFSET + LOOP_OFFSET)].clone_from_slice(&src[(10 - some_var)..(LOOP_OFFSET - some_var)])`
343
344 error: it looks like you're manually copying between slices
345   --> $DIR/for_loop.rs:421:14
346    |
347 LL |     for i in 0..src_vec.len() {
348    |              ^^^^^^^^^^^^^^^^ help: try replacing the loop by: `dst_vec[..src_vec.len()].clone_from_slice(&src_vec[..])`
349
350 error: it looks like you're manually copying between slices
351   --> $DIR/for_loop.rs:450:14
352    |
353 LL |     for i in from..from + src.len() {
354    |              ^^^^^^^^^^^^^^^^^^^^^^ help: try replacing the loop by: `dst[from..from + src.len()].clone_from_slice(&src[0..(from + src.len() - from)])`
355
356 error: it looks like you're manually copying between slices
357   --> $DIR/for_loop.rs:454:14
358    |
359 LL |     for i in from..from + 3 {
360    |              ^^^^^^^^^^^^^^ help: try replacing the loop by: `dst[from..from + 3].clone_from_slice(&src[0..(from + 3 - from)])`
361
362 error: it looks like you're manually copying between slices
363   --> $DIR/for_loop.rs:461:14
364    |
365 LL |     for i in 0..src.len() {
366    |              ^^^^^^^^^^^^ help: try replacing the loop by: `dst[..src.len()].clone_from_slice(&src[..])`
367
368 error: aborting due to 46 previous errors
369