From f95141c10938ba0de40a2318ec2f325fc60f9e42 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu <sam@rfc1149.net> Date: Wed, 2 Oct 2024 23:27:54 +0200 Subject: [PATCH] style: use `.filter_map()` instead of `.flat_map()` where appropriate --- Cargo.toml | 1 + lib/src/fileset.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 819f417c14..4bda1245b7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -134,6 +134,7 @@ testutils = { path = "lib/testutils" } [workspace.lints.clippy] explicit_iter_loop = "deny" +flat_map_option = "deny" implicit_clone = "deny" redundant_else = "deny" semicolon_if_nothing_returned = "deny" diff --git a/lib/src/fileset.rs b/lib/src/fileset.rs index dae932a6f9..18b78ad288 100644 --- a/lib/src/fileset.rs +++ b/lib/src/fileset.rs @@ -297,7 +297,7 @@ impl FilesetExpression { pub fn explicit_paths(&self) -> impl Iterator<Item = &RepoPath> { // pre/post-ordering doesn't matter so long as children are visited from // left to right. - self.dfs_pre().flat_map(|expr| match expr { + self.dfs_pre().filter_map(|expr| match expr { FilesetExpression::Pattern(pattern) => pattern.as_path(), _ => None, })