rust-lang/rust-clippy
Auf GitHub ansehenIterators: suggest `position()` instead of `enumerate() + find() + .0`
Open
#2.282 geöffnet am 20. Dez. 2017
A-lintT-middlegood first issue
Repository-Metriken
- Stars
- (10.406 Stars)
- PR-Merge-Metriken
- (Durchschn. Merge 19T 22h) (113 gemergte PRs in 30 T)
Beschreibung
This is sort of the opposite of #456. I recently wrote let idx = v.iter().enumerate().find(|&(_, &ch)| ch == '|').unwrap().0, when I should have written let idx = v.iter().position(|&ch| ch == '|').unwrap(). I'd have to think a little on the exact rule that should be followed here, but it would be nice if clippy could catch this pattern.