rust-lang/rust-clippy
View on GitHubLint suggesting from_fn instead of while let Some(x)
Open
#3940 opened on Apr 11, 2019
A-lintL-styleL-suggestiongood first issue
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.)