rust-lang/rust-clippy

Lint suggesting from_fn instead of while let Some(x)

Open

#3,940 创建于 2019年4月11日

在 GitHub 查看
 (1 评论) (0 反应) (0 负责人)Rust (1,391 fork)batch import
A-lintL-styleL-suggestiongood first issue

仓库指标

Star
 (10,406 star)
PR 合并指标
 (平均合并 19天 22小时) (30 天内合并 113 个 PR)

描述

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

贡献者指南