From e3788ea868ea4f9a0183c8dbe9f82fdc12c76335 Mon Sep 17 00:00:00 2001 From: Federico Terzi Date: Tue, 5 Oct 2021 23:18:11 +0200 Subject: [PATCH] fix(mac-utils): fix warnings --- espanso-mac-utils/src/lib.rs | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/espanso-mac-utils/src/lib.rs b/espanso-mac-utils/src/lib.rs index 7a13b2d..89dbee1 100644 --- a/espanso-mac-utils/src/lib.rs +++ b/espanso-mac-utils/src/lib.rs @@ -86,32 +86,20 @@ fn get_app_name_from_path(path: &str) -> Option { }; let caps = APP_REGEX.captures(&path); - if let Some(caps) = caps { - Some(caps.get(1).map_or("", |m| m.as_str()).to_owned()) - } else { - None - } + caps.map(|caps| caps.get(1).map_or("", |m| m.as_str()).to_owned()) } #[cfg(target_os = "macos")] pub fn check_accessibility() -> bool { unsafe { - if ffi::mac_utils_check_accessibility() > 0 { - true - } else { - false - } + ffi::mac_utils_check_accessibility() > 0 } } #[cfg(target_os = "macos")] pub fn prompt_accessibility() -> bool { unsafe { - if ffi::mac_utils_prompt_accessibility() > 0 { - true - } else { - false - } + ffi::mac_utils_prompt_accessibility() > 0 } }