error: for loop over `option`, which is an `Option`. This is more readably written as an `if let` statement. --> $DIR/for_loop.rs:18:14 | 18 | for x in option { | ^^^^^^ | = note: #[deny(for_loop_over_option)] implied by #[deny(clippy)] note: lint level defined here --> $DIR/for_loop.rs:10:8 | 10 | #[deny(clippy)] | ^^^^^^ = 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:26:14 | 26 | for x in result { | ^^^^^^ | = note: #[deny(for_loop_over_result)] implied by #[deny(clippy)] note: lint level defined here --> $DIR/for_loop.rs:10:8 | 10 | #[deny(clippy)] | ^^^^^^ = 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:32:14 | 32 | for x in option.ok_or("x not found") { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: #[deny(for_loop_over_result)] implied by #[deny(clippy)] = help: consider replacing `for x in option.ok_or("x not found")` with `if let Ok(x) = option.ok_or("x not found")` 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:40:5 | 40 | / for x in v.iter().next() { 41 | | 42 | | println!("{}", x); 43 | | } | |_____^ | = note: #[deny(iter_next_loop)] implied by #[deny(clippy)] note: lint level defined here --> $DIR/for_loop.rs:10:8 | 10 | #[deny(clippy)] | ^^^^^^ error: for loop over `v.iter().next().and(Some(0))`, which is an `Option`. This is more readably written as an `if let` statement. --> $DIR/for_loop.rs:47:14 | 47 | for x in v.iter().next().and(Some(0)) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: #[deny(for_loop_over_option)] implied by #[deny(clippy)] = help: consider replacing `for x in v.iter().next().and(Some(0))` with `if let Some(x) = v.iter().next().and(Some(0))` 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. --> $DIR/for_loop.rs:53:14 | 53 | for x in v.iter().next().ok_or("x not found") { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: #[deny(for_loop_over_result)] implied by #[deny(clippy)] = 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: the loop variable `i` is only used to index `vec`. --> $DIR/for_loop.rs:99:5 | 99 | / for i in 0..vec.len() { 100 | | 101 | | 102 | | 103 | | 104 | | println!("{}", vec[i]); 105 | | } | |_____^ | note: lint level defined here --> $DIR/for_loop.rs:90:8 | 90 | #[deny(needless_range_loop, explicit_iter_loop, explicit_into_iter_loop, iter_next_loop, reverse_range_loop, explicit_counter_loop, for_kv_map)] | ^^^^^^^^^^^^^^^^^^^ help: consider using an iterator | for in &vec { warning: unused variable: `i` --> $DIR/for_loop.rs:107:9 | 107 | for i in 0..vec.len() { | ^ | = note: #[warn(unused_variables)] on by default error: the loop variable `i` is only used to index `vec`. --> $DIR/for_loop.rs:113:5 | 113 | for i in 0..vec.len() { let _ = vec[i]; } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: consider using an iterator | for in &vec { let _ = vec[i]; } error: the loop variable `j` is only used to index `STATIC`. --> $DIR/for_loop.rs:120:5 | 120 | / for j in 0..4 { 121 | | 122 | | 123 | | 124 | | 125 | | println!("{:?}", STATIC[j]); 126 | | } | |_____^ | help: consider using an iterator | for in STATIC.iter().take(4) { error: the loop variable `j` is only used to index `CONST`. --> $DIR/for_loop.rs:128:5 | 128 | / for j in 0..4 { 129 | | 130 | | 131 | | 132 | | 133 | | println!("{:?}", CONST[j]); 134 | | } | |_____^ | help: consider using an iterator | for in CONST.iter().take(4) { error: the loop variable `i` is used to index `vec` --> $DIR/for_loop.rs:136:5 | 136 | / for i in 0..vec.len() { 137 | | 138 | | 139 | | 140 | | 141 | | println!("{} {}", vec[i], i); 142 | | } | |_____^ | help: consider using an iterator | for (i, ) in vec.iter().enumerate() { error: the loop variable `i` is only used to index `vec2`. --> $DIR/for_loop.rs:147:5 | 147 | / for i in 0..vec.len() { 148 | | 149 | | 150 | | 151 | | 152 | | println!("{}", vec2[i]); 153 | | } | |_____^ | help: consider using an iterator | for in vec2.iter().take(vec.len()) { error: the loop variable `i` is only used to index `vec`. --> $DIR/for_loop.rs:155:5 | 155 | / for i in 5..vec.len() { 156 | | 157 | | 158 | | 159 | | 160 | | println!("{}", vec[i]); 161 | | } | |_____^ | help: consider using an iterator | for in vec.iter().skip(5) { error: the loop variable `i` is only used to index `vec`. --> $DIR/for_loop.rs:163:5 | 163 | / for i in 0..MAX_LEN { 164 | | 165 | | 166 | | 167 | | 168 | | println!("{}", vec[i]); 169 | | } | |_____^ | help: consider using an iterator | for in vec.iter().take(MAX_LEN) { error: the loop variable `i` is only used to index `vec`. --> $DIR/for_loop.rs:171:5 | 171 | / for i in 0...MAX_LEN { 172 | | 173 | | 174 | | 175 | | 176 | | println!("{}", vec[i]); 177 | | } | |_____^ | help: consider using an iterator | for in vec.iter().take(MAX_LEN + 1) { error: the loop variable `i` is only used to index `vec`. --> $DIR/for_loop.rs:179:5 | 179 | / for i in 5..10 { 180 | | 181 | | 182 | | 183 | | 184 | | println!("{}", vec[i]); 185 | | } | |_____^ | help: consider using an iterator | for in vec.iter().take(10).skip(5) { error: the loop variable `i` is only used to index `vec`. --> $DIR/for_loop.rs:187:5 | 187 | / for i in 5...10 { 188 | | 189 | | 190 | | 191 | | 192 | | println!("{}", vec[i]); 193 | | } | |_____^ | help: consider using an iterator | for in vec.iter().take(10 + 1).skip(5) { error: the loop variable `i` is used to index `vec` --> $DIR/for_loop.rs:195:5 | 195 | / for i in 5..vec.len() { 196 | | 197 | | 198 | | 199 | | 200 | | println!("{} {}", vec[i], i); 201 | | } | |_____^ | help: consider using an iterator | for (i, ) in vec.iter().enumerate().skip(5) { error: the loop variable `i` is used to index `vec` --> $DIR/for_loop.rs:203:5 | 203 | / for i in 5..10 { 204 | | 205 | | 206 | | 207 | | 208 | | println!("{} {}", vec[i], i); 209 | | } | |_____^ | help: consider using an iterator | for (i, ) in vec.iter().enumerate().take(10).skip(5) { error: this range is empty so this for loop will never run --> $DIR/for_loop.rs:211:5 | 211 | / for i in 10..0 { 212 | | 213 | | 214 | | 215 | | println!("{}", i); 216 | | } | |_____^ | note: lint level defined here --> $DIR/for_loop.rs:90:90 | 90 | #[deny(needless_range_loop, explicit_iter_loop, explicit_into_iter_loop, iter_next_loop, reverse_range_loop, explicit_counter_loop, for_kv_map)] | ^^^^^^^^^^^^^^^^^^ help: consider using the following if you are attempting to iterate over this range in reverse | for i in (0..10).rev() { error: this range is empty so this for loop will never run --> $DIR/for_loop.rs:218:5 | 218 | / for i in 10...0 { 219 | | 220 | | 221 | | 222 | | println!("{}", i); 223 | | } | |_____^ | help: consider using the following if you are attempting to iterate over this range in reverse | for i in (0...10).rev() { error: this range is empty so this for loop will never run --> $DIR/for_loop.rs:225:5 | 225 | / for i in MAX_LEN..0 { 226 | | 227 | | 228 | | println!("{}", i); 229 | | } | |_____^ | help: consider using the following if you are attempting to iterate over this range in reverse | for i in (0..MAX_LEN).rev() { error: this range is empty so this for loop will never run --> $DIR/for_loop.rs:231:5 | 231 | / for i in 5..5 { 232 | | println!("{}", i); 233 | | } | |_____^ error: this range is empty so this for loop will never run --> $DIR/for_loop.rs:252:5 | 252 | / for i in 10..5+4 { 253 | | 254 | | 255 | | 256 | | println!("{}", i); 257 | | } | |_____^ | help: consider using the following if you are attempting to iterate over this range in reverse | for i in (5+4..10).rev() { error: this range is empty so this for loop will never run --> $DIR/for_loop.rs:259:5 | 259 | / for i in (5+2)..(3-1) { 260 | | 261 | | 262 | | 263 | | println!("{}", i); 264 | | } | |_____^ | help: consider using the following if you are attempting to iterate over this range in reverse | for i in ((3-1)..(5+2)).rev() { error: this range is empty so this for loop will never run --> $DIR/for_loop.rs:266:5 | 266 | / for i in (5+2)..(8-1) { 267 | | println!("{}", i); 268 | | } | |_____^ error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods --> $DIR/for_loop.rs:289:15 | 289 | for _v in vec.iter() { } | ^^^^^^^^^^ help: to write this more concisely, try `&vec` | note: lint level defined here --> $DIR/for_loop.rs:90:29 | 90 | #[deny(needless_range_loop, explicit_iter_loop, explicit_into_iter_loop, iter_next_loop, reverse_range_loop, explicit_counter_loop, for_kv_map)] | ^^^^^^^^^^^^^^^^^^ error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods --> $DIR/for_loop.rs:294:15 | 294 | for _v in vec.iter_mut() { } | ^^^^^^^^^^^^^^ help: to write this more concisely, try `&mut vec` error: it is more idiomatic to loop over containers instead of using explicit iteration methods` --> $DIR/for_loop.rs:300:15 | 300 | for _v in out_vec.into_iter() { } | ^^^^^^^^^^^^^^^^^^^ help: to write this more concisely, try `out_vec` | note: lint level defined here --> $DIR/for_loop.rs:90:49 | 90 | #[deny(needless_range_loop, explicit_iter_loop, explicit_into_iter_loop, iter_next_loop, reverse_range_loop, explicit_counter_loop, for_kv_map)] | ^^^^^^^^^^^^^^^^^^^^^^^ error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods --> $DIR/for_loop.rs:306:15 | 306 | for _v in array.into_iter() {} | ^^^^^^^^^^^^^^^^^ help: to write this more concisely, try `&array` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods --> $DIR/for_loop.rs:311:15 | 311 | for _v in [1, 2, 3].iter() { } | ^^^^^^^^^^^^^^^^ help: to write this more concisely, try `&[1, 2, 3]` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods --> $DIR/for_loop.rs:318:15 | 318 | for _v in [0; 32].iter() {} | ^^^^^^^^^^^^^^ help: to write this more concisely, try `&[0; 32]` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods --> $DIR/for_loop.rs:326:15 | 326 | for _v in ll.iter() { } | ^^^^^^^^^ help: to write this more concisely, try `&ll` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods --> $DIR/for_loop.rs:332:15 | 332 | for _v in vd.iter() { } | ^^^^^^^^^ help: to write this more concisely, try `&vd` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods --> $DIR/for_loop.rs:338:15 | 338 | for _v in bh.iter() { } | ^^^^^^^^^ help: to write this more concisely, try `&bh` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods --> $DIR/for_loop.rs:344:15 | 344 | for _v in hm.iter() { } | ^^^^^^^^^ help: to write this more concisely, try `&hm` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods --> $DIR/for_loop.rs:350:15 | 350 | for _v in bt.iter() { } | ^^^^^^^^^ help: to write this more concisely, try `&bt` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods --> $DIR/for_loop.rs:356:15 | 356 | for _v in hs.iter() { } | ^^^^^^^^^ help: to write this more concisely, try `&hs` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods --> $DIR/for_loop.rs:362:15 | 362 | 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:368:5 | 368 | for _v in vec.iter().next() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here --> $DIR/for_loop.rs:90:74 | 90 | #[deny(needless_range_loop, explicit_iter_loop, explicit_into_iter_loop, iter_next_loop, reverse_range_loop, explicit_counter_loop, for_kv_map)] | ^^^^^^^^^^^^^^ 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:375:5 | 375 | vec.iter().map(|x| out.push(x)).collect::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here --> $DIR/for_loop.rs:91:8 | 91 | #[deny(unused_collect)] | ^^^^^^^^^^^^^^ error: the variable `_index` is used as a loop counter. Consider using `for (_index, item) in &vec.enumerate()` or similar iterators --> $DIR/for_loop.rs:380:5 | 380 | for _v in &vec { _index += 1 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here --> $DIR/for_loop.rs:90:110 | 90 | #[deny(needless_range_loop, explicit_iter_loop, explicit_into_iter_loop, iter_next_loop, reverse_range_loop, explicit_counter_loop, for_kv_map)] | ^^^^^^^^^^^^^^^^^^^^^ error: the variable `_index` is used as a loop counter. Consider using `for (_index, item) in &vec.enumerate()` or similar iterators --> $DIR/for_loop.rs:384:5 | 384 | for _v in &vec { _index += 1 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you seem to want to iterate on a map's values --> $DIR/for_loop.rs:444:5 | 444 | / for (_, v) in &m { 445 | | 446 | | 447 | | 448 | | 449 | | let _v = v; 450 | | } | |_____^ | note: lint level defined here --> $DIR/for_loop.rs:90:133 | 90 | #[deny(needless_range_loop, explicit_iter_loop, explicit_into_iter_loop, iter_next_loop, reverse_range_loop, explicit_counter_loop, for_kv_map)] | ^^^^^^^^^^ help: use the corresponding method | for v in m.values() { error: you seem to want to iterate on a map's values --> $DIR/for_loop.rs:453:5 | 453 | / for (_, v) in &*m { 454 | | 455 | | 456 | | ... | 460 | | // `in *m.values()` as we used to 461 | | } | |_____^ | help: use the corresponding method | for v in (*m).values() { error: you seem to want to iterate on a map's values --> $DIR/for_loop.rs:464:5 | 464 | / for (_, v) in &mut m { 465 | | 466 | | 467 | | 468 | | 469 | | let _v = v; 470 | | } | |_____^ | help: use the corresponding method | for v in m.values_mut() { error: you seem to want to iterate on a map's values --> $DIR/for_loop.rs:473:5 | 473 | / for (_, v) in &mut *m { 474 | | 475 | | 476 | | 477 | | 478 | | let _v = v; 479 | | } | |_____^ | help: use the corresponding method | for v in (*m).values_mut() { error: you seem to want to iterate on a map's keys --> $DIR/for_loop.rs:483:5 | 483 | / for (k, _value) in rm { 484 | | 485 | | 486 | | 487 | | 488 | | let _k = k; 489 | | } | |_____^ | help: use the corresponding method | for k in rm.keys() { error: aborting due to 48 previous errors