rust/tests/ui/for_loop.stderr

422 lines
14 KiB
Text
Raw Normal View History

error: the loop variable `i` is only used to index `vec`.
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:50:14
|
2018-12-10 06:27:19 +01:00
50 | for i in 0..vec.len() {
2018-01-29 05:18:11 +01:00
| ^^^^^^^^^^^^
|
= note: `-D clippy::needless-range-loop` implied by `-D warnings`
help: consider using an iterator
2017-07-10 15:29:29 +02:00
|
2018-12-10 06:27:19 +01:00
50 | for <item> in &vec {
2018-05-29 10:56:58 +02:00
| ^^^^^^ ^^^^
error: the loop variable `i` is only used to index `vec`.
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:59:14
|
2018-12-10 06:27:19 +01:00
59 | for i in 0..vec.len() {
| ^^^^^^^^^^^^
help: consider using an iterator
|
2018-12-10 06:27:19 +01:00
59 | for <item> in &vec {
| ^^^^^^ ^^^^
error: the loop variable `j` is only used to index `STATIC`.
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:64:14
|
2018-12-10 06:27:19 +01:00
64 | for j in 0..4 {
| ^^^^
help: consider using an iterator
|
2018-12-10 06:27:19 +01:00
64 | for <item> in &STATIC {
| ^^^^^^ ^^^^^^^
error: the loop variable `j` is only used to index `CONST`.
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:68:14
|
2018-12-10 06:27:19 +01:00
68 | for j in 0..4 {
| ^^^^
help: consider using an iterator
|
2018-12-10 06:27:19 +01:00
68 | for <item> in &CONST {
| ^^^^^^ ^^^^^^
error: the loop variable `i` is used to index `vec`
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:72:14
|
2018-12-10 06:27:19 +01:00
72 | for i in 0..vec.len() {
| ^^^^^^^^^^^^
help: consider using an iterator
|
2018-12-10 06:27:19 +01:00
72 | for (i, <item>) in vec.iter().enumerate() {
| ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^
error: the loop variable `i` is only used to index `vec2`.
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:80:14
|
2018-12-10 06:27:19 +01:00
80 | for i in 0..vec.len() {
| ^^^^^^^^^^^^
help: consider using an iterator
|
2018-12-10 06:27:19 +01:00
80 | for <item> in vec2.iter().take(vec.len()) {
| ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: the loop variable `i` is only used to index `vec`.
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:84:14
|
2018-12-10 06:27:19 +01:00
84 | for i in 5..vec.len() {
| ^^^^^^^^^^^^
help: consider using an iterator
|
2018-12-10 06:27:19 +01:00
84 | for <item> in vec.iter().skip(5) {
| ^^^^^^ ^^^^^^^^^^^^^^^^^^
error: the loop variable `i` is only used to index `vec`.
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:88:14
|
2018-12-10 06:27:19 +01:00
88 | for i in 0..MAX_LEN {
| ^^^^^^^^^^
help: consider using an iterator
|
2018-12-10 06:27:19 +01:00
88 | for <item> in vec.iter().take(MAX_LEN) {
| ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^
error: the loop variable `i` is only used to index `vec`.
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:92:14
|
2018-12-10 06:27:19 +01:00
92 | for i in 0..=MAX_LEN {
| ^^^^^^^^^^^
help: consider using an iterator
|
2018-12-10 06:27:19 +01:00
92 | for <item> in vec.iter().take(MAX_LEN + 1) {
| ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: the loop variable `i` is only used to index `vec`.
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:96:14
|
2018-12-10 06:27:19 +01:00
96 | for i in 5..10 {
| ^^^^^
help: consider using an iterator
|
2018-12-10 06:27:19 +01:00
96 | for <item> in vec.iter().take(10).skip(5) {
| ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: the loop variable `i` is only used to index `vec`.
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:100:14
|
100 | for i in 5..=10 {
| ^^^^^^
help: consider using an iterator
2018-12-10 06:27:19 +01:00
|
100 | for <item> in vec.iter().take(10 + 1).skip(5) {
| ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: the loop variable `i` is used to index `vec`
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:104:14
|
104 | for i in 5..vec.len() {
| ^^^^^^^^^^^^
help: consider using an iterator
2018-12-10 06:27:19 +01:00
|
104 | for (i, <item>) in vec.iter().enumerate().skip(5) {
| ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: the loop variable `i` is used to index `vec`
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:108:14
|
108 | for i in 5..10 {
| ^^^^^
help: consider using an iterator
2018-12-10 06:27:19 +01:00
|
108 | for (i, <item>) in vec.iter().enumerate().take(10).skip(5) {
| ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: this range is empty so this for loop will never run
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:112:14
|
2018-12-10 06:27:19 +01:00
112 | for i in 10..0 {
2018-01-29 05:18:11 +01:00
| ^^^^^
|
= note: `-D clippy::reverse-range-loop` implied by `-D warnings`
help: consider using the following if you are attempting to iterate over this range in reverse
2017-07-10 15:29:29 +02:00
|
2018-12-10 06:27:19 +01:00
112 | for i in (0..10).rev() {
2017-07-10 15:29:29 +02:00
| ^^^^^^^^^^^^^
error: this range is empty so this for loop will never run
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:116:14
|
2018-12-10 06:27:19 +01:00
116 | for i in 10..=0 {
2018-01-29 05:18:11 +01:00
| ^^^^^^
help: consider using the following if you are attempting to iterate over this range in reverse
2017-07-10 15:29:29 +02:00
|
2018-12-10 06:27:19 +01:00
116 | for i in (0...10).rev() {
2017-07-10 15:29:29 +02:00
| ^^^^^^^^^^^^^^
error: this range is empty so this for loop will never run
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:120:14
|
2018-12-10 06:27:19 +01:00
120 | for i in MAX_LEN..0 {
2018-01-29 05:18:11 +01:00
| ^^^^^^^^^^
help: consider using the following if you are attempting to iterate over this range in reverse
2017-07-10 15:29:29 +02:00
|
2018-12-10 06:27:19 +01:00
120 | for i in (0..MAX_LEN).rev() {
2017-07-10 15:29:29 +02:00
| ^^^^^^^^^^^^^^^^^^
error: this range is empty so this for loop will never run
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:124:14
|
2018-12-10 06:27:19 +01:00
124 | for i in 5..5 {
2018-01-29 05:18:11 +01:00
| ^^^^
error: this range is empty so this for loop will never run
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:149:14
|
2018-12-10 06:27:19 +01:00
149 | for i in 10..5 + 4 {
2018-01-29 05:18:11 +01:00
| ^^^^^^^^^
help: consider using the following if you are attempting to iterate over this range in reverse
2017-07-10 15:29:29 +02:00
|
2018-12-10 06:27:19 +01:00
149 | for i in (5 + 4..10).rev() {
| ^^^^^^^^^^^^^^^^^
error: this range is empty so this for loop will never run
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:153:14
|
2018-12-10 06:27:19 +01:00
153 | for i in (5 + 2)..(3 - 1) {
2018-01-29 05:18:11 +01:00
| ^^^^^^^^^^^^^^^^
help: consider using the following if you are attempting to iterate over this range in reverse
2017-07-10 15:29:29 +02:00
|
2018-12-10 06:27:19 +01:00
153 | for i in ((3 - 1)..(5 + 2)).rev() {
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: this range is empty so this for loop will never run
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:157:14
|
2018-12-10 06:27:19 +01:00
157 | for i in (5 + 2)..(8 - 1) {
2018-01-29 05:18:11 +01:00
| ^^^^^^^^^^^^^^^^
error: it is more concise to loop over references to containers instead of using explicit iteration methods
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:179:15
|
2018-12-10 06:27:19 +01:00
179 | for _v in vec.iter() {}
2017-07-21 10:40:23 +02:00
| ^^^^^^^^^^ help: to write this more concisely, try: `&vec`
|
= note: `-D clippy::explicit-iter-loop` implied by `-D warnings`
error: it is more concise to loop over references to containers instead of using explicit iteration methods
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:181:15
|
2018-12-10 06:27:19 +01:00
181 | for _v in vec.iter_mut() {}
2017-07-21 10:40:23 +02:00
| ^^^^^^^^^^^^^^ help: to write this more concisely, try: `&mut vec`
error: it is more concise to loop over containers instead of using explicit iteration methods`
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:184:15
|
2018-12-10 06:27:19 +01:00
184 | for _v in out_vec.into_iter() {}
2017-07-21 10:40:23 +02:00
| ^^^^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `out_vec`
|
= note: `-D clippy::explicit-into-iter-loop` implied by `-D warnings`
error: it is more concise to loop over references to containers instead of using explicit iteration methods
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:187:15
|
2018-12-10 06:27:19 +01:00
187 | for _v in array.into_iter() {}
2017-07-21 10:40:23 +02:00
| ^^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `&array`
2017-02-21 12:13:44 +01:00
error: it is more concise to loop over references to containers instead of using explicit iteration methods
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:192:15
2017-02-21 12:13:44 +01:00
|
2018-12-10 06:27:19 +01:00
192 | for _v in [1, 2, 3].iter() {}
2017-07-21 10:40:23 +02:00
| ^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `&[1, 2, 3]`
error: it is more concise to loop over references to containers instead of using explicit iteration methods
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:196:15
|
2018-12-10 06:27:19 +01:00
196 | for _v in [0; 32].iter() {}
2017-07-21 10:40:23 +02:00
| ^^^^^^^^^^^^^^ help: to write this more concisely, try: `&[0; 32]`
error: it is more concise to loop over references to containers instead of using explicit iteration methods
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:201:15
|
2018-12-10 06:27:19 +01:00
201 | for _v in ll.iter() {}
2017-07-21 10:40:23 +02:00
| ^^^^^^^^^ help: to write this more concisely, try: `&ll`
error: it is more concise to loop over references to containers instead of using explicit iteration methods
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:204:15
|
2018-12-10 06:27:19 +01:00
204 | for _v in vd.iter() {}
2017-07-21 10:40:23 +02:00
| ^^^^^^^^^ help: to write this more concisely, try: `&vd`
error: it is more concise to loop over references to containers instead of using explicit iteration methods
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:207:15
|
2018-12-10 06:27:19 +01:00
207 | for _v in bh.iter() {}
2017-07-21 10:40:23 +02:00
| ^^^^^^^^^ help: to write this more concisely, try: `&bh`
error: it is more concise to loop over references to containers instead of using explicit iteration methods
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:210:15
|
2018-12-10 06:27:19 +01:00
210 | for _v in hm.iter() {}
2017-07-21 10:40:23 +02:00
| ^^^^^^^^^ help: to write this more concisely, try: `&hm`
error: it is more concise to loop over references to containers instead of using explicit iteration methods
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:213:15
|
2018-12-10 06:27:19 +01:00
213 | for _v in bt.iter() {}
2017-07-21 10:40:23 +02:00
| ^^^^^^^^^ help: to write this more concisely, try: `&bt`
error: it is more concise to loop over references to containers instead of using explicit iteration methods
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:216:15
|
2018-12-10 06:27:19 +01:00
216 | for _v in hs.iter() {}
2017-07-21 10:40:23 +02:00
| ^^^^^^^^^ help: to write this more concisely, try: `&hs`
error: it is more concise to loop over references to containers instead of using explicit iteration methods
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:219:15
|
2018-12-10 06:27:19 +01:00
219 | for _v in bs.iter() {}
2017-07-21 10:40:23 +02:00
| ^^^^^^^^^ help: to write this more concisely, try: `&bs`
error: you are iterating over `Iterator::next()` which is an Option; this will compile but is probably not what you want
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:221:15
|
2018-12-10 06:27:19 +01:00
221 | for _v in vec.iter().next() {}
2018-01-29 05:18:11 +01:00
| ^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::iter-next-loop` implied by `-D warnings`
error: you are collect()ing an iterator and throwing away the result. Consider using an explicit for loop to exhaust the iterator
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:228:5
|
2018-12-10 06:27:19 +01:00
228 | vec.iter().cloned().map(|x| out.push(x)).collect::<Vec<_>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::unused-collect` implied by `-D warnings`
error: you seem to want to iterate on a map's values
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:337:19
|
2018-12-10 06:27:19 +01:00
337 | for (_, v) in &m {
2018-01-29 05:18:11 +01:00
| ^^
|
= note: `-D clippy::for-kv-map` implied by `-D warnings`
help: use the corresponding method
2017-07-10 15:29:29 +02:00
|
2018-12-10 06:27:19 +01:00
337 | for v in m.values() {
2018-05-29 10:56:58 +02:00
| ^ ^^^^^^^^^^
error: you seem to want to iterate on a map's values
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:342:19
2018-01-29 05:18:11 +01:00
|
2018-12-10 06:27:19 +01:00
342 | for (_, v) in &*m {
2018-01-29 05:18:11 +01:00
| ^^^
help: use the corresponding method
2017-07-10 15:29:29 +02:00
|
2018-12-10 06:27:19 +01:00
342 | for v in (*m).values() {
2018-05-29 10:56:58 +02:00
| ^ ^^^^^^^^^^^^^
error: you seem to want to iterate on a map's values
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:350:19
|
2018-12-10 06:27:19 +01:00
350 | for (_, v) in &mut m {
2018-01-29 05:18:11 +01:00
| ^^^^^^
help: use the corresponding method
2017-07-10 15:29:29 +02:00
|
2018-12-10 06:27:19 +01:00
350 | for v in m.values_mut() {
2018-05-29 10:56:58 +02:00
| ^ ^^^^^^^^^^^^^^
error: you seem to want to iterate on a map's values
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:355:19
|
2018-12-10 06:27:19 +01:00
355 | for (_, v) in &mut *m {
2018-01-29 05:18:11 +01:00
| ^^^^^^^
help: use the corresponding method
2017-07-10 15:29:29 +02:00
|
2018-12-10 06:27:19 +01:00
355 | for v in (*m).values_mut() {
2018-05-29 10:56:58 +02:00
| ^ ^^^^^^^^^^^^^^^^^
error: you seem to want to iterate on a map's keys
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:361:24
|
2018-12-10 06:27:19 +01:00
361 | for (k, _value) in rm {
2018-01-29 05:18:11 +01:00
| ^^
help: use the corresponding method
2017-07-10 15:29:29 +02:00
|
2018-12-10 06:27:19 +01:00
361 | for k in rm.keys() {
2018-05-29 10:56:58 +02:00
| ^ ^^^^^^^^^
2017-09-05 02:16:34 +02:00
error: it looks like you're manually copying between slices
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:414:14
2017-09-05 02:16:34 +02:00
|
2018-12-10 06:27:19 +01:00
414 | for i in 0..src.len() {
2018-01-29 05:18:11 +01:00
| ^^^^^^^^^^^^ help: try replacing the loop by: `dst[..src.len()].clone_from_slice(&src[..])`
2017-09-05 02:16:34 +02:00
|
= note: `-D clippy::manual-memcpy` implied by `-D warnings`
2017-09-05 02:16:34 +02:00
error: it looks like you're manually copying between slices
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:419:14
|
2018-12-10 06:27:19 +01:00
419 | for i in 0..src.len() {
2018-01-29 05:18:11 +01:00
| ^^^^^^^^^^^^ help: try replacing the loop by: `dst[10..(src.len() + 10)].clone_from_slice(&src[..])`
2017-09-05 02:16:34 +02:00
error: it looks like you're manually copying between slices
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:424:14
|
2018-12-10 06:27:19 +01:00
424 | for i in 0..src.len() {
2018-01-29 05:18:11 +01:00
| ^^^^^^^^^^^^ help: try replacing the loop by: `dst[..src.len()].clone_from_slice(&src[10..])`
2017-09-05 02:16:34 +02:00
error: it looks like you're manually copying between slices
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:429:14
|
2018-12-10 06:27:19 +01:00
429 | for i in 11..src.len() {
2018-01-29 05:18:11 +01:00
| ^^^^^^^^^^^^^ help: try replacing the loop by: `dst[11..src.len()].clone_from_slice(&src[(11 - 10)..(src.len() - 10)])`
2017-09-05 02:16:34 +02:00
error: it looks like you're manually copying between slices
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:434:14
|
2018-12-10 06:27:19 +01:00
434 | for i in 0..dst.len() {
2018-01-29 05:18:11 +01:00
| ^^^^^^^^^^^^ help: try replacing the loop by: `dst.clone_from_slice(&src[..dst.len()])`
2017-09-05 02:16:34 +02:00
error: it looks like you're manually copying between slices
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:447:14
|
2018-12-10 06:27:19 +01:00
447 | for i in 10..256 {
2018-01-29 05:18:11 +01:00
| ^^^^^^^
2017-09-05 02:16:34 +02:00
help: try replacing the loop by
|
2018-12-10 06:27:19 +01:00
447 | for i in dst[10..256].clone_from_slice(&src[(10 - 5)..(256 - 5)])
448 | dst2[(10 + 500)..(256 + 500)].clone_from_slice(&src[10..256]) {
2017-09-05 02:16:34 +02:00
|
error: it looks like you're manually copying between slices
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:459:14
2017-09-05 02:16:34 +02:00
|
2018-12-10 06:27:19 +01:00
459 | for i in 10..LOOP_OFFSET {
2018-01-29 05:18:11 +01:00
| ^^^^^^^^^^^^^^^ 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)])`
2017-09-05 02:16:34 +02:00
error: it looks like you're manually copying between slices
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:472:14
2017-09-05 02:16:34 +02:00
|
2018-12-10 06:27:19 +01:00
472 | for i in 0..src_vec.len() {
2018-01-29 05:18:11 +01:00
| ^^^^^^^^^^^^^^^^ help: try replacing the loop by: `dst_vec[..src_vec.len()].clone_from_slice(&src_vec[..])`
error: it looks like you're manually copying between slices
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:501:14
|
2018-12-10 06:27:19 +01:00
501 | for i in from..from + src.len() {
| ^^^^^^^^^^^^^^^^^^^^^^ help: try replacing the loop by: `dst[from..from + src.len()].clone_from_slice(&src[0..(from + src.len() - from)])`
error: it looks like you're manually copying between slices
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:505:14
|
2018-12-10 06:27:19 +01:00
505 | for i in from..from + 3 {
| ^^^^^^^^^^^^^^ help: try replacing the loop by: `dst[from..from + 3].clone_from_slice(&src[0..(from + 3 - from)])`
error: it looks like you're manually copying between slices
2018-12-10 06:27:19 +01:00
--> $DIR/for_loop.rs:512:14
|
2018-12-10 06:27:19 +01:00
512 | for i in 0..src.len() {
2018-01-29 05:18:11 +01:00
| ^^^^^^^^^^^^ help: try replacing the loop by: `dst[..src.len()].clone_from_slice(&src[..])`
error: aborting due to 51 previous errors
2018-01-16 17:06:27 +01:00