Skip to content

warn on iter.enumerate.map(|(_, pat)| expr) #12411

@KisaragiEffective

Description

@KisaragiEffective

What it does

emits warning on iterator.enumerate().map(|(_unused_index, elem)| expr).

Advantage

  • Removes counter, improving performance.

Drawbacks

None

Example

https://github.com/KisaragiEffective/origlang/blob/fa487aab90c7bbe1b0b4ebaedfa33b847985a1ba/package/origlang-compiler/src/type_check.rs#L270:

iter.enumerate().map(|(_i, elem)| { whatever })

Could be written as:

iter.map(|elem| { whatever })

Metadata

Metadata

Assignees

Labels

A-lintArea: New lints

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions