From 41a17c8f57970ccfa23e06325425b0fee0e52be4 Mon Sep 17 00:00:00 2001 From: mxve <68632137+mxve@users.noreply.github.com> Date: Fri, 4 Oct 2024 17:34:23 +0200 Subject: [PATCH] replace map flatten with and_then --- src/misc.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/misc.rs b/src/misc.rs index 309b138..c2525ad 100644 --- a/src/misc.rs +++ b/src/misc.rs @@ -42,14 +42,13 @@ pub fn pb_style_download(pb: &ProgressBar, state: bool) { #[cfg(unix)] pub fn is_program_in_path(program: &str) -> bool { std::env::var_os("PATH") - .map(|paths| { + .and_then(|paths| { paths.to_str().map(|paths| { paths .split(':') .any(|dir| fs::metadata(format!("{}/{}", dir, program)).is_ok()) }) }) - .flatten() .unwrap_or(false) }