From 4d2c1b4dc276b1ee9553960d972ee1ffacb8f4ad Mon Sep 17 00:00:00 2001 From: Slinetrac Date: Tue, 21 Oct 2025 23:20:27 +0800 Subject: [PATCH] fix: resolve clippy lint in linux utils --- src-tauri/src/utils/linux.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src-tauri/src/utils/linux.rs b/src-tauri/src/utils/linux.rs index fd85338be..446412ef4 100644 --- a/src-tauri/src/utils/linux.rs +++ b/src-tauri/src/utils/linux.rs @@ -536,7 +536,7 @@ pub fn ensure_mimeapps_entries(desktop_file: &str, schemes: &[&str]) -> Result<( if !default_present { changed = true; - if !output_lines.is_empty() && !output_lines.last().unwrap().is_empty() { + if output_lines.last().is_some_and(|line| !line.is_empty()) { output_lines.push(String::new()); } output_lines.push("[Default Applications]".to_string()); @@ -572,10 +572,8 @@ fn mimeapps_list_path() -> Option { dir }); - if let Some(ref path) = config_path { - if path.exists() { - return Some(path.clone()); - } + if config_path.as_ref().is_some_and(|path| path.exists()) { + return config_path; } let data_path = env::var_os("XDG_DATA_HOME") @@ -593,10 +591,8 @@ fn mimeapps_list_path() -> Option { dir }); - if let Some(ref path) = data_path { - if path.exists() { - return Some(path.clone()); - } + if data_path.as_ref().is_some_and(|path| path.exists()) { + return data_path; } config_path