1 #![warn(clippy::explicit_counter_loop)]
4 let mut vec = vec![1, 2, 3, 4];
29 // should not trigger the lint because variable is used after the loop #473
30 let vec = vec![1, 2, 3];
35 println!("index: {}", index);
37 // should not trigger the lint because the count is conditional #1219
40 for ch in text.chars() {
41 println!("{}", count);
48 // should not trigger the lint because the count is conditional
51 for ch in text.chars() {
52 println!("{}", count);
58 // should trigger the lint because the count is not conditional
61 for ch in text.chars() {
62 println!("{}", count);
69 // should trigger the lint because the count is not conditional
72 for ch in text.chars() {
73 println!("{}", count);
80 // should not trigger the lint because the count is incremented multiple times
83 for ch in text.chars() {
84 println!("{}", count);
95 // should not trigger the lint because the count is incremented multiple times
97 let erasures = vec![];
99 println!("{}", skips);
100 while erasures.contains(&(i + skips)) {
105 // should not trigger the lint because the count is incremented multiple times
108 println!("{}", skips);
116 // should not trigger the lint because the count is incremented multiple times
119 println!("{}", skips);
138 let slice = &[1, 2, 3];
141 // should not trigger the lint because the count is used after the loop
145 let _closure = || println!("index: {}", index);
151 let slice = &[1, 2, 3];
153 // should not trigger the lint because the count is used after incremented
157 println!("{}", count);