rust-lang/rust-clippy

Lint suggesting from_fn instead of while let Some(x)

Open

#3.940 aberto em 11 de abr. de 2019

Ver no GitHub
 (1 comment) (0 reactions) (0 assignees)Rust (1.391 forks)batch import
A-lintL-styleL-suggestiongood first issue

Métricas do repositório

Stars
 (10.406 stars)
Métricas de merge de PR
 (Mesclagem média 19d 22h) (113 fundiu PRs em 30d)

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

Guia do colaborador