From 9dd3c70a8433e004f54f4059b44f3f9cd3ac7d3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Tue, 30 Apr 2024 17:53:20 +0200 Subject: [PATCH] Use filter_map --- src/cli/task.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/cli/task.rs b/src/cli/task.rs index f7a119eb9..b81f13c9a 100644 --- a/src/cli/task.rs +++ b/src/cli/task.rs @@ -311,10 +311,13 @@ pub fn execute(args: Args) -> miette::Result<()> { env.tasks(Some(Platform::current())) .into_iter() .flat_map(|tasks| { - tasks - .into_iter() - .filter(|&(key, _)| !key.as_str().starts_with('_')) - .map(|(key, _)| key) + tasks.into_iter().filter_map(|(key, _)| { + if !key.as_str().starts_with('_') { + Some(key) + } else { + None + } + }) }) .map(ToOwned::to_owned) })