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() { | _____^ starting here... 41 | | //~^ ERROR you are iterating over `Iterator::next()` which is an Option 42 | | println!("{}", x); 43 | | } | |_____^ ...ending here | = 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() { | _____^ starting here... 100 | | //~^ ERROR `i` is only used to index `vec` 101 | | //~| HELP consider 102 | | //~| HELP consider 103 | | //~| SUGGESTION for in &vec { 104 | | println!("{}", vec[i]); 105 | | } | |_____^ ...ending here | 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 { | _____^ starting here... 121 | | //~^ ERROR `j` is only used to index `STATIC` 122 | | //~| HELP consider 123 | | //~| HELP consider 124 | | //~| SUGGESTION for in STATIC.iter().take(4) { 125 | | println!("{:?}", STATIC[j]); 126 | | } | |_____^ ...ending here | 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 { | _____^ starting here... 129 | | //~^ ERROR `j` is only used to index `CONST` 130 | | //~| HELP consider 131 | | //~| HELP consider 132 | | //~| SUGGESTION for in CONST.iter().take(4) { 133 | | println!("{:?}", CONST[j]); 134 | | } | |_____^ ...ending here | 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() { | _____^ starting here... 137 | | //~^ ERROR `i` is used to index `vec` 138 | | //~| HELP consider 139 | | //~| HELP consider 140 | | //~| SUGGESTION for (i, ) in vec.iter().enumerate() { 141 | | println!("{} {}", vec[i], i); 142 | | } | |_____^ ...ending here | 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() { | _____^ starting here... 148 | | //~^ ERROR `i` is only used to index `vec2` 149 | | //~| HELP consider 150 | | //~| HELP consider 151 | | //~| SUGGESTION for in vec2.iter().take(vec.len()) { 152 | | println!("{}", vec2[i]); 153 | | } | |_____^ ...ending here | 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() { | _____^ starting here... 156 | | //~^ ERROR `i` is only used to index `vec` 157 | | //~| HELP consider 158 | | //~| HELP consider 159 | | //~| SUGGESTION for in vec.iter().skip(5) { 160 | | println!("{}", vec[i]); 161 | | } | |_____^ ...ending here | 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 { | _____^ starting here... 164 | | //~^ ERROR `i` is only used to index `vec` 165 | | //~| HELP consider 166 | | //~| HELP consider 167 | | //~| SUGGESTION for in vec.iter().take(MAX_LEN) { 168 | | println!("{}", vec[i]); 169 | | } | |_____^ ...ending here | 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 { | _____^ starting here... 172 | | //~^ ERROR `i` is only used to index `vec` 173 | | //~| HELP consider 174 | | //~| HELP consider 175 | | //~| SUGGESTION for in vec.iter().take(MAX_LEN + 1) { 176 | | println!("{}", vec[i]); 177 | | } | |_____^ ...ending here | 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 { | _____^ starting here... 180 | | //~^ ERROR `i` is only used to index `vec` 181 | | //~| HELP consider 182 | | //~| HELP consider 183 | | //~| SUGGESTION for in vec.iter().take(10).skip(5) { 184 | | println!("{}", vec[i]); 185 | | } | |_____^ ...ending here | 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 { | _____^ starting here... 188 | | //~^ ERROR `i` is only used to index `vec` 189 | | //~| HELP consider 190 | | //~| HELP consider 191 | | //~| SUGGESTION for in vec.iter().take(10 + 1).skip(5) { 192 | | println!("{}", vec[i]); 193 | | } | |_____^ ...ending here | 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() { | _____^ starting here... 196 | | //~^ ERROR `i` is used to index `vec` 197 | | //~| HELP consider 198 | | //~| HELP consider 199 | | //~| SUGGESTION for (i, ) in vec.iter().enumerate().skip(5) { 200 | | println!("{} {}", vec[i], i); 201 | | } | |_____^ ...ending here | 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 { | _____^ starting here... 204 | | //~^ ERROR `i` is used to index `vec` 205 | | //~| HELP consider 206 | | //~| HELP consider 207 | | //~| SUGGESTION for (i, ) in vec.iter().enumerate().take(10).skip(5) { 208 | | println!("{} {}", vec[i], i); 209 | | } | |_____^ ...ending here | 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 { | _____^ starting here... 212 | | //~^ERROR this range is empty so this for loop will never run 213 | | //~|HELP consider 214 | | //~|SUGGESTION (0..10).rev() 215 | | println!("{}", i); 216 | | } | |_____^ ...ending here | 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 { | _____^ starting here... 219 | | //~^ERROR this range is empty so this for loop will never run 220 | | //~|HELP consider 221 | | //~|SUGGESTION (0...10).rev() 222 | | println!("{}", i); 223 | | } | |_____^ ...ending here | 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 { //~ERROR this range is empty so this for loop will never run | _____^ starting here... 226 | | //~|HELP consider 227 | | //~|SUGGESTION (0..MAX_LEN).rev() 228 | | println!("{}", i); 229 | | } | |_____^ ...ending here | 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 error: this range is empty so this for loop will never run --> $DIR/for_loop.rs:231:5 | 231 | for i in 5..5 { //~ERROR this range is empty so this for loop will never run | _____^ starting here... 232 | | println!("{}", i); 233 | | } | |_____^ ...ending here 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 { | _____^ starting here... 253 | | //~^ ERROR this range is empty so this for loop will never run 254 | | //~| HELP if you are attempting to iterate over this range in reverse 255 | | //~| SUGGESTION for i in (5+4..10).rev() { 256 | | println!("{}", i); 257 | | } | |_____^ ...ending here | 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) { | _____^ starting here... 260 | | //~^ ERROR this range is empty so this for loop will never run 261 | | //~| HELP if you are attempting to iterate over this range in reverse 262 | | //~| SUGGESTION for i in ((3-1)..(5+2)).rev() { 263 | | println!("{}", i); 264 | | } | |_____^ ...ending here | 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) { //~ERROR this range is empty so this for loop will never run | _____^ starting here... 267 | | println!("{}", i); 268 | | } | |_____^ ...ending here error: it is more idiomatic to loop over `&vec` instead of `vec.iter()` --> $DIR/for_loop.rs:289:15 | 289 | for _v in vec.iter() { } | ^^^^^^^^^^ | 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)] | ^^^^^^^^^^^^^^^^^^ help: to write this more concisely, try looping over | for _v in &vec { } error: it is more idiomatic to loop over `&mut vec` instead of `vec.iter_mut()` --> $DIR/for_loop.rs:294:15 | 294 | for _v in vec.iter_mut() { } | ^^^^^^^^^^^^^^ | help: to write this more concisely, try looping over | for _v in &mut vec { } error: it is more idiomatic to loop over `out_vec` instead of `out_vec.into_iter()` --> $DIR/for_loop.rs:300:15 | 300 | for _v in out_vec.into_iter() { } | ^^^^^^^^^^^^^^^^^^^ | 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)] | ^^^^^^^^^^^^^^^^^^^^^^^ help: to write this more concisely, try looping over | for _v in out_vec { } error: it is more idiomatic to loop over `&[1, 2, 3]` instead of `[1, 2, 3].iter()` --> $DIR/for_loop.rs:308:15 | 308 | for _v in [1, 2, 3].iter() { } | ^^^^^^^^^^^^^^^^ | help: to write this more concisely, try looping over | for _v in &[1, 2, 3] { } error: it is more idiomatic to loop over `&[0; 32]` instead of `[0; 32].iter()` --> $DIR/for_loop.rs:315:15 | 315 | for _v in [0; 32].iter() {} | ^^^^^^^^^^^^^^ | help: to write this more concisely, try looping over | for _v in &[0; 32] {} error: it is more idiomatic to loop over `&ll` instead of `ll.iter()` --> $DIR/for_loop.rs:323:15 | 323 | for _v in ll.iter() { } | ^^^^^^^^^ | help: to write this more concisely, try looping over | for _v in &ll { } error: it is more idiomatic to loop over `&vd` instead of `vd.iter()` --> $DIR/for_loop.rs:329:15 | 329 | for _v in vd.iter() { } | ^^^^^^^^^ | help: to write this more concisely, try looping over | for _v in &vd { } error: it is more idiomatic to loop over `&bh` instead of `bh.iter()` --> $DIR/for_loop.rs:335:15 | 335 | for _v in bh.iter() { } | ^^^^^^^^^ | help: to write this more concisely, try looping over | for _v in &bh { } error: it is more idiomatic to loop over `&hm` instead of `hm.iter()` --> $DIR/for_loop.rs:341:15 | 341 | for _v in hm.iter() { } | ^^^^^^^^^ | help: to write this more concisely, try looping over | for _v in &hm { } error: it is more idiomatic to loop over `&bt` instead of `bt.iter()` --> $DIR/for_loop.rs:347:15 | 347 | for _v in bt.iter() { } | ^^^^^^^^^ | help: to write this more concisely, try looping over | for _v in &bt { } error: it is more idiomatic to loop over `&hs` instead of `hs.iter()` --> $DIR/for_loop.rs:353:15 | 353 | for _v in hs.iter() { } | ^^^^^^^^^ | help: to write this more concisely, try looping over | for _v in &hs { } error: it is more idiomatic to loop over `&bs` instead of `bs.iter()` --> $DIR/for_loop.rs:359:15 | 359 | for _v in bs.iter() { } | ^^^^^^^^^ | help: to write this more concisely, try looping over | for _v in &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:365:5 | 365 | for _v in vec.iter().next() { } //~ERROR you are iterating over `Iterator::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:372:5 | 372 | vec.iter().map(|x| out.push(x)).collect::>(); //~ERROR you are collect()ing an iterator | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | 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:377:5 | 377 | for _v in &vec { _index += 1 } //~ERROR the variable `_index` is used as a loop counter | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | 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:381:5 | 381 | for _v in &vec { _index += 1 } //~ERROR the variable `_index` is used as a loop counter | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you seem to want to iterate on a map's values --> $DIR/for_loop.rs:441:5 | 441 | for (_, v) in &m { | _____^ starting here... 442 | | //~^ you seem to want to iterate on a map's values 443 | | //~| HELP use the corresponding method 444 | | //~| HELP use the corresponding method 445 | | //~| SUGGESTION for v in m.values() { 446 | | let _v = v; 447 | | } | |_____^ ...ending here | 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:450:5 | 450 | for (_, v) in &*m { | _____^ starting here... 451 | | //~^ you seem to want to iterate on a map's values 452 | | //~| HELP use the corresponding method 453 | | //~| HELP use the corresponding method 454 | | //~| SUGGESTION for v in (*m).values() { 455 | | let _v = v; 456 | | // Here the `*` is not actually necesarry, but the test tests that we don't suggest 457 | | // `in *m.values()` as we used to 458 | | } | |_____^ ...ending here | 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:461:5 | 461 | for (_, v) in &mut m { | _____^ starting here... 462 | | //~^ you seem to want to iterate on a map's values 463 | | //~| HELP use the corresponding method 464 | | //~| HELP use the corresponding method 465 | | //~| SUGGESTION for v in m.values_mut() 466 | | let _v = v; 467 | | } | |_____^ ...ending here | 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:470:5 | 470 | for (_, v) in &mut *m { | _____^ starting here... 471 | | //~^ you seem to want to iterate on a map's values 472 | | //~| HELP use the corresponding method 473 | | //~| HELP use the corresponding method 474 | | //~| SUGGESTION for v in (*m).values_mut() 475 | | let _v = v; 476 | | } | |_____^ ...ending here | 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:480:5 | 480 | for (k, _value) in rm { | _____^ starting here... 481 | | //~^ you seem to want to iterate on a map's keys 482 | | //~| HELP use the corresponding method 483 | | //~| HELP use the corresponding method 484 | | //~| SUGGESTION for k in rm.keys() { 485 | | let _k = k; 486 | | } | |_____^ ...ending here | help: use the corresponding method | for k in rm.keys() { error: aborting due to 47 previous errors