RS.CLIPPY.RANGE_ZIP_WITH_LEN

Zipping iterator with a range when `enumerate()` would do

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: range_zip_with_len. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Checks for zipping a collection with the range of 0.._.len().

Why is this bad?

The code is better expressed with .enumerate().

Example

let _ = x.iter().zip(0..x.len());

Use instead:

let _ = x.iter().enumerate();