-error: for loop over `option`, which is an `Option`. This is more readably written as an `if let` statement.
- --> $DIR/for_loop.rs:27:14
- |
-27 | for x in option {
- | ^^^^^^
- |
- = note: `-D clippy::for-loop-over-option` implied by `-D warnings`
- = help: consider replacing `for x in option` with `if let Some(x) = option`
-
-error: for loop over `result`, which is a `Result`. This is more readably written as an `if let` statement.
- --> $DIR/for_loop.rs:32:14
- |
-32 | for x in result {
- | ^^^^^^
+error: this range is empty so this for loop will never run
+ --> $DIR/for_loop.rs:39:14
|
- = note: `-D clippy::for-loop-over-result` implied by `-D warnings`
- = help: consider replacing `for x in result` with `if let Ok(x) = result`
-
-error: for loop over `option.ok_or("x not found")`, which is a `Result`. This is more readably written as an `if let` statement.
- --> $DIR/for_loop.rs:36:14
+LL | for i in 10..0 {
+ | ^^^^^
|
-36 | for x in option.ok_or("x not found") {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = 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
|
- = help: consider replacing `for x in option.ok_or("x not found")` with `if let Ok(x) = option.ok_or("x not found")`
+LL | for i in (0..10).rev() {
+ | ^^^^^^^^^^^^^
-error: you are iterating over `Iterator::next()` which is an Option; this will compile but is probably not what you want
- --> $DIR/for_loop.rs:42:14
+error: this range is empty so this for loop will never run
+ --> $DIR/for_loop.rs:43:14
|
-42 | for x in v.iter().next() {
- | ^^^^^^^^^^^^^^^
+LL | for i in 10..=0 {
+ | ^^^^^^
+help: consider using the following if you are attempting to iterate over this range in reverse
|
- = note: `-D clippy::iter-next-loop` implied by `-D warnings`
+LL | for i in (0...10).rev() {
+ | ^^^^^^^^^^^^^^
-error: for loop over `v.iter().next().and(Some(0))`, which is an `Option`. This is more readably written as an `if let` statement.
+error: this range is empty so this for loop will never run
--> $DIR/for_loop.rs:47:14
|
-47 | for x in v.iter().next().and(Some(0)) {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | for i in MAX_LEN..0 {
+ | ^^^^^^^^^^
+help: consider using the following if you are attempting to iterate over this range in reverse
|
- = help: consider replacing `for x in v.iter().next().and(Some(0))` with `if let Some(x) = v.iter().next().and(Some(0))`
+LL | for i in (0..MAX_LEN).rev() {
+ | ^^^^^^^^^^^^^^^^^^
-error: for loop over `v.iter().next().ok_or("x not found")`, which is a `Result`. This is more readably written as an `if let` statement.
+error: this range is empty so this for loop will never run
--> $DIR/for_loop.rs:51:14
|
-51 | for x in v.iter().next().ok_or("x not found") {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = help: consider replacing `for x in v.iter().next().ok_or("x not found")` with `if let Ok(x) = v.iter().next().ok_or("x not found")`
-
-error: this loop never actually loops
- --> $DIR/for_loop.rs:63:5
- |
-63 | / while let Some(x) = option {
-64 | | println!("{}", x);
-65 | | break;
-66 | | }
- | |_____^
- |
- = note: `-D clippy::never-loop` implied by `-D warnings`
-
-error: this loop never actually loops
- --> $DIR/for_loop.rs:69:5
- |
-69 | / while let Ok(x) = result {
-70 | | println!("{}", x);
-71 | | break;
-72 | | }
- | |_____^
-
-error: the loop variable `i` is only used to index `vec`.
- --> $DIR/for_loop.rs:96:14
- |
-96 | for i in 0..vec.len() {
- | ^^^^^^^^^^^^
- |
- = note: `-D clippy::needless-range-loop` implied by `-D warnings`
-help: consider using an iterator
- |
-96 | for <item> in &vec {
- | ^^^^^^ ^^^^
-
-error: the loop variable `i` is only used to index `vec`.
- --> $DIR/for_loop.rs:105:14
- |
-105 | for i in 0..vec.len() {
- | ^^^^^^^^^^^^
-help: consider using an iterator
- |
-105 | for <item> in &vec {
- | ^^^^^^ ^^^^
-
-error: the loop variable `j` is only used to index `STATIC`.
- --> $DIR/for_loop.rs:110:14
- |
-110 | for j in 0..4 {
- | ^^^^
-help: consider using an iterator
- |
-110 | for <item> in &STATIC {
- | ^^^^^^ ^^^^^^^
-
-error: the loop variable `j` is only used to index `CONST`.
- --> $DIR/for_loop.rs:114:14
- |
-114 | for j in 0..4 {
- | ^^^^
-help: consider using an iterator
- |
-114 | for <item> in &CONST {
- | ^^^^^^ ^^^^^^
-
-error: the loop variable `i` is used to index `vec`
- --> $DIR/for_loop.rs:118:14
- |
-118 | for i in 0..vec.len() {
- | ^^^^^^^^^^^^
-help: consider using an iterator
- |
-118 | for (i, <item>) in vec.iter().enumerate() {
- | ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^
-
-error: the loop variable `i` is only used to index `vec2`.
- --> $DIR/for_loop.rs:126:14
- |
-126 | for i in 0..vec.len() {
- | ^^^^^^^^^^^^
-help: consider using an iterator
- |
-126 | for <item> in vec2.iter().take(vec.len()) {
- | ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: the loop variable `i` is only used to index `vec`.
- --> $DIR/for_loop.rs:130:14
- |
-130 | for i in 5..vec.len() {
- | ^^^^^^^^^^^^
-help: consider using an iterator
- |
-130 | for <item> in vec.iter().skip(5) {
- | ^^^^^^ ^^^^^^^^^^^^^^^^^^
-
-error: the loop variable `i` is only used to index `vec`.
- --> $DIR/for_loop.rs:134:14
- |
-134 | for i in 0..MAX_LEN {
- | ^^^^^^^^^^
-help: consider using an iterator
- |
-134 | for <item> in vec.iter().take(MAX_LEN) {
- | ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: the loop variable `i` is only used to index `vec`.
- --> $DIR/for_loop.rs:138:14
- |
-138 | for i in 0..=MAX_LEN {
- | ^^^^^^^^^^^
-help: consider using an iterator
- |
-138 | for <item> in vec.iter().take(MAX_LEN + 1) {
- | ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: the loop variable `i` is only used to index `vec`.
- --> $DIR/for_loop.rs:142:14
- |
-142 | for i in 5..10 {
- | ^^^^^
-help: consider using an iterator
- |
-142 | for <item> in vec.iter().take(10).skip(5) {
- | ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: the loop variable `i` is only used to index `vec`.
- --> $DIR/for_loop.rs:146:14
- |
-146 | for i in 5..=10 {
- | ^^^^^^
-help: consider using an iterator
- |
-146 | for <item> in vec.iter().take(10 + 1).skip(5) {
- | ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: the loop variable `i` is used to index `vec`
- --> $DIR/for_loop.rs:150:14
- |
-150 | for i in 5..vec.len() {
- | ^^^^^^^^^^^^
-help: consider using an iterator
- |
-150 | for (i, <item>) in vec.iter().enumerate().skip(5) {
- | ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: the loop variable `i` is used to index `vec`
- --> $DIR/for_loop.rs:154:14
- |
-154 | for i in 5..10 {
- | ^^^^^
-help: consider using an iterator
- |
-154 | for (i, <item>) in vec.iter().enumerate().take(10).skip(5) {
- | ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: this range is empty so this for loop will never run
- --> $DIR/for_loop.rs:158:14
- |
-158 | for i in 10..0 {
- | ^^^^^
- |
- = 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
- |
-158 | for i in (0..10).rev() {
- | ^^^^^^^^^^^^^
+LL | for i in 5..5 {
+ | ^^^^
error: this range is empty so this for loop will never run
- --> $DIR/for_loop.rs:162:14
- |
-162 | for i in 10..=0 {
- | ^^^^^^
-help: consider using the following if you are attempting to iterate over this range in reverse
- |
-162 | for i in (0...10).rev() {
- | ^^^^^^^^^^^^^^
-
-error: this range is empty so this for loop will never run
- --> $DIR/for_loop.rs:166:14
- |
-166 | for i in MAX_LEN..0 {
- | ^^^^^^^^^^
-help: consider using the following if you are attempting to iterate over this range in reverse
- |
-166 | for i in (0..MAX_LEN).rev() {
- | ^^^^^^^^^^^^^^^^^^
-
-error: this range is empty so this for loop will never run
- --> $DIR/for_loop.rs:170:14
- |
-170 | for i in 5..5 {
- | ^^^^
-
-error: this range is empty so this for loop will never run
- --> $DIR/for_loop.rs:195:14
- |
-195 | for i in 10..5 + 4 {
- | ^^^^^^^^^
+ --> $DIR/for_loop.rs:76:14
+ |
+LL | for i in 10..5 + 4 {
+ | ^^^^^^^^^
help: consider using the following if you are attempting to iterate over this range in reverse
- |
-195 | for i in (5 + 4..10).rev() {
- | ^^^^^^^^^^^^^^^^^
+ |
+LL | for i in (5 + 4..10).rev() {
+ | ^^^^^^^^^^^^^^^^^
error: this range is empty so this for loop will never run
- --> $DIR/for_loop.rs:199:14
- |
-199 | for i in (5 + 2)..(3 - 1) {
- | ^^^^^^^^^^^^^^^^
+ --> $DIR/for_loop.rs:80:14
+ |
+LL | for i in (5 + 2)..(3 - 1) {
+ | ^^^^^^^^^^^^^^^^
help: consider using the following if you are attempting to iterate over this range in reverse
- |
-199 | for i in ((3 - 1)..(5 + 2)).rev() {
- | ^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+LL | for i in ((3 - 1)..(5 + 2)).rev() {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
error: this range is empty so this for loop will never run
- --> $DIR/for_loop.rs:203:14
- |
-203 | for i in (5 + 2)..(8 - 1) {
- | ^^^^^^^^^^^^^^^^
+ --> $DIR/for_loop.rs:84:14
+ |
+LL | for i in (5 + 2)..(8 - 1) {
+ | ^^^^^^^^^^^^^^^^
error: it is more concise to loop over references to containers instead of using explicit iteration methods
- --> $DIR/for_loop.rs:225:15
- |
-225 | for _v in vec.iter() {}
- | ^^^^^^^^^^ help: to write this more concisely, try: `&vec`
- |
- = note: `-D clippy::explicit-iter-loop` implied by `-D warnings`
+ --> $DIR/for_loop.rs:106:15
+ |
+LL | for _v in vec.iter() {}
+ | ^^^^^^^^^^ 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
- --> $DIR/for_loop.rs:227:15
- |
-227 | for _v in vec.iter_mut() {}
- | ^^^^^^^^^^^^^^ help: to write this more concisely, try: `&mut vec`
+ --> $DIR/for_loop.rs:108:15
+ |
+LL | for _v in vec.iter_mut() {}
+ | ^^^^^^^^^^^^^^ help: to write this more concisely, try: `&mut vec`
error: it is more concise to loop over containers instead of using explicit iteration methods`
- --> $DIR/for_loop.rs:230:15
- |
-230 | for _v in out_vec.into_iter() {}
- | ^^^^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `out_vec`
- |
- = note: `-D clippy::explicit-into-iter-loop` implied by `-D warnings`
+ --> $DIR/for_loop.rs:111:15
+ |
+LL | for _v in out_vec.into_iter() {}
+ | ^^^^^^^^^^^^^^^^^^^ 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
- --> $DIR/for_loop.rs:233:15
- |
-233 | for _v in array.into_iter() {}
- | ^^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `&array`
+ --> $DIR/for_loop.rs:114:15
+ |
+LL | for _v in array.into_iter() {}
+ | ^^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `&array`
error: it is more concise to loop over references to containers instead of using explicit iteration methods
- --> $DIR/for_loop.rs:238:15
- |
-238 | for _v in [1, 2, 3].iter() {}
- | ^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `&[1, 2, 3]`
+ --> $DIR/for_loop.rs:119:15
+ |
+LL | for _v in [1, 2, 3].iter() {}
+ | ^^^^^^^^^^^^^^^^ 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
- --> $DIR/for_loop.rs:242:15
- |
-242 | for _v in [0; 32].iter() {}
- | ^^^^^^^^^^^^^^ help: to write this more concisely, try: `&[0; 32]`
+ --> $DIR/for_loop.rs:123:15
+ |
+LL | for _v in [0; 32].iter() {}
+ | ^^^^^^^^^^^^^^ 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
- --> $DIR/for_loop.rs:247:15
- |
-247 | for _v in ll.iter() {}
- | ^^^^^^^^^ help: to write this more concisely, try: `&ll`
+ --> $DIR/for_loop.rs:128:15
+ |
+LL | for _v in ll.iter() {}
+ | ^^^^^^^^^ 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
- --> $DIR/for_loop.rs:250:15
- |
-250 | for _v in vd.iter() {}
- | ^^^^^^^^^ help: to write this more concisely, try: `&vd`
+ --> $DIR/for_loop.rs:131:15
+ |
+LL | for _v in vd.iter() {}
+ | ^^^^^^^^^ 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
- --> $DIR/for_loop.rs:253:15
- |
-253 | for _v in bh.iter() {}
- | ^^^^^^^^^ help: to write this more concisely, try: `&bh`
+ --> $DIR/for_loop.rs:134:15
+ |
+LL | for _v in bh.iter() {}
+ | ^^^^^^^^^ 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
- --> $DIR/for_loop.rs:256:15
- |
-256 | for _v in hm.iter() {}
- | ^^^^^^^^^ help: to write this more concisely, try: `&hm`
+ --> $DIR/for_loop.rs:137:15
+ |
+LL | for _v in hm.iter() {}
+ | ^^^^^^^^^ 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
- --> $DIR/for_loop.rs:259:15
- |
-259 | for _v in bt.iter() {}
- | ^^^^^^^^^ help: to write this more concisely, try: `&bt`
+ --> $DIR/for_loop.rs:140:15
+ |
+LL | for _v in bt.iter() {}
+ | ^^^^^^^^^ 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
- --> $DIR/for_loop.rs:262:15
- |
-262 | for _v in hs.iter() {}
- | ^^^^^^^^^ help: to write this more concisely, try: `&hs`
+ --> $DIR/for_loop.rs:143:15
+ |
+LL | for _v in hs.iter() {}
+ | ^^^^^^^^^ 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
- --> $DIR/for_loop.rs:265:15
- |
-265 | for _v in bs.iter() {}
- | ^^^^^^^^^ help: to write this more concisely, try: `&bs`
+ --> $DIR/for_loop.rs:146:15
+ |
+LL | for _v in bs.iter() {}
+ | ^^^^^^^^^ 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
- --> $DIR/for_loop.rs:267:15
- |
-267 | for _v in vec.iter().next() {}
- | ^^^^^^^^^^^^^^^^^
-
-error: you are collect()ing an iterator and throwing away the result. Consider using an explicit for loop to exhaust the iterator
- --> $DIR/for_loop.rs:274:5
- |
-274 | 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
- --> $DIR/for_loop.rs:385:19
- |
-385 | for (_, v) in &m {
- | ^^
- |
- = note: `-D clippy::for-kv-map` implied by `-D warnings`
-help: use the corresponding method
- |
-385 | for v in m.values() {
- | ^ ^^^^^^^^^^
-
-error: you seem to want to iterate on a map's values
- --> $DIR/for_loop.rs:390:19
- |
-390 | for (_, v) in &*m {
- | ^^^
-help: use the corresponding method
- |
-390 | for v in (*m).values() {
- | ^ ^^^^^^^^^^^^^
-
-error: you seem to want to iterate on a map's values
- --> $DIR/for_loop.rs:398:19
- |
-398 | for (_, v) in &mut m {
- | ^^^^^^
-help: use the corresponding method
- |
-398 | for v in m.values_mut() {
- | ^ ^^^^^^^^^^^^^^
-
-error: you seem to want to iterate on a map's values
- --> $DIR/for_loop.rs:403:19
- |
-403 | for (_, v) in &mut *m {
- | ^^^^^^^
-help: use the corresponding method
- |
-403 | for v in (*m).values_mut() {
- | ^ ^^^^^^^^^^^^^^^^^
-
-error: you seem to want to iterate on a map's keys
- --> $DIR/for_loop.rs:409:24
- |
-409 | for (k, _value) in rm {
- | ^^
-help: use the corresponding method
- |
-409 | for k in rm.keys() {
- | ^ ^^^^^^^^^
-
-error: it looks like you're manually copying between slices
- --> $DIR/for_loop.rs:462:14
- |
-462 | for i in 0..src.len() {
- | ^^^^^^^^^^^^ help: try replacing the loop by: `dst[..src.len()].clone_from_slice(&src[..])`
- |
- = note: `-D clippy::manual-memcpy` implied by `-D warnings`
-
-error: it looks like you're manually copying between slices
- --> $DIR/for_loop.rs:467:14
- |
-467 | for i in 0..src.len() {
- | ^^^^^^^^^^^^ help: try replacing the loop by: `dst[10..(src.len() + 10)].clone_from_slice(&src[..])`
-
-error: it looks like you're manually copying between slices
- --> $DIR/for_loop.rs:472:14
- |
-472 | for i in 0..src.len() {
- | ^^^^^^^^^^^^ help: try replacing the loop by: `dst[..src.len()].clone_from_slice(&src[10..])`
-
-error: it looks like you're manually copying between slices
- --> $DIR/for_loop.rs:477:14
- |
-477 | for i in 11..src.len() {
- | ^^^^^^^^^^^^^ help: try replacing the loop by: `dst[11..src.len()].clone_from_slice(&src[(11 - 10)..(src.len() - 10)])`
-
-error: it looks like you're manually copying between slices
- --> $DIR/for_loop.rs:482:14
- |
-482 | for i in 0..dst.len() {
- | ^^^^^^^^^^^^ help: try replacing the loop by: `dst.clone_from_slice(&src[..dst.len()])`
-
-error: it looks like you're manually copying between slices
- --> $DIR/for_loop.rs:495:14
- |
-495 | for i in 10..256 {
- | ^^^^^^^
-help: try replacing the loop by
- |
-495 | for i in dst[10..256].clone_from_slice(&src[(10 - 5)..(256 - 5)])
-496 | dst2[(10 + 500)..(256 + 500)].clone_from_slice(&src[10..256]) {
- |
-
-error: it looks like you're manually copying between slices
- --> $DIR/for_loop.rs:507:14
- |
-507 | for i in 10..LOOP_OFFSET {
- | ^^^^^^^^^^^^^^^ 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)])`
-
-error: it looks like you're manually copying between slices
- --> $DIR/for_loop.rs:520:14
- |
-520 | for i in 0..src_vec.len() {
- | ^^^^^^^^^^^^^^^^ 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
- --> $DIR/for_loop.rs:549:14
- |
-549 | 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
- --> $DIR/for_loop.rs:553:14
- |
-553 | for i in from..from + 3 {
- | ^^^^^^^^^^^^^^ help: try replacing the loop by: `dst[from..from + 3].clone_from_slice(&src[0..(from + 3 - from)])`
+ --> $DIR/for_loop.rs:148:15
+ |
+LL | for _v in vec.iter().next() {}
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: `-D clippy::iter-next-loop` implied by `-D warnings`
-error: it looks like you're manually copying between slices
- --> $DIR/for_loop.rs:560:14
- |
-560 | for i in 0..src.len() {
- | ^^^^^^^^^^^^ help: try replacing the loop by: `dst[..src.len()].clone_from_slice(&src[..])`
+error: the loop variable `i` is only used to index `vec`.
+ --> $DIR/for_loop.rs:281:14
+ |
+LL | for i in ZERO..vec.len() {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: `-D clippy::needless-range-loop` implied by `-D warnings`
+help: consider using an iterator
+ |
+LL | for <item> in &vec {
+ | ^^^^^^ ^^^^
-error: aborting due to 59 previous errors
+error: aborting due to 22 previous errors