Rust

Rust

By DeepSource

Unused `.enumerate()` or `.zip(..)` itemsRS-W1039

Anti-pattern

The items generated by this enumerate or zip call are unused. Consider using the items produced, or removing this method call.

Examples

Bad practice

for (_, item) in vec![1, 2, 3].enumerate() {
    println!("{}", item);
}

Recommended

for (idx, item) in vec![1, 2, 3].enumerate() {
    println!("{}: {}", idx, item);
}