rust-lang/rust-clippy

Lint suggesting from_fn instead of while let Some(x)

Open

#3 940 ouverte le 11 avr. 2019

Voir sur GitHub
 (1 commentaire) (0 réactions) (0 assignés)Rust (1 391 forks)batch import
A-lintL-styleL-suggestiongood first issue

Métriques du dépôt

Stars
 (10 406 stars)
Métriques de merge PR
 (Merge moyen 19j 22h) (113 PRs mergées en 30 j)

Description

With the release of 1.34 with the from_fn function, I'd like to propose a new lint that matches: while let Some(x) = expr and suggests replacing it with for x in from_fn(|| expr). (With a special-case for while let Some(x) = fn() that suggests for x in from_fn(fn) if possible.)

Guide contributeur