rust-lang/rust-clippy

Lint suggesting from_fn instead of while let Some(x)

Open

#3.940 geöffnet am 11. Apr. 2019

Auf GitHub ansehen
 (1 Kommentar) (0 Reaktionen) (0 zugewiesene Personen)Rust (1.391 Forks)batch import
A-lintL-styleL-suggestiongood first issue

Repository-Metriken

Stars
 (10.406 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 19T 22h) (113 gemergte PRs in 30 T)

Beschreibung

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

Contributor Guide