Rust logoRust/
RS-W1012

Zipping iterator with a range when `enumerate()` would doRS-W1012

Minor severityMinor
Anti-pattern categoryAnti-pattern

Zipping an iterator with a range from 0 to the iterator's length is better expressed with .enumerate().

Remove the call to .zip() and replace with a call to .enumerate(). This is easier to read and the intent is obvious.

Bad practice

x.iter().zip(0..x.len());
x.iter().enumerate();