rust-lang/rust-clippy

Lint suggesting from_fn instead of while let Some(x)

Open

#3940 aperta il 11 apr 2019

Vedi su GitHub
 (1 commento) (0 reazioni) (0 assegnatari)Rust (1391 fork)batch import
A-lintL-styleL-suggestiongood first issue

Metriche repository

Star
 (10.406 star)
Metriche merge PR
 (Merge medio 19g 22h) (113 PR mergiate in 30 g)

Descrizione

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.)

Guida contributor