From efec43b3b8827820cf35fe1b73d8e33f5fe84eb4 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 20 Jun 2026 01:16:50 +0900 Subject: refactor: auto-fix clippy warnings --- crates/shirabe/src/util/platform.rs | 52 +++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 28 deletions(-) (limited to 'crates/shirabe/src/util/platform.rs') diff --git a/crates/shirabe/src/util/platform.rs b/crates/shirabe/src/util/platform.rs index 7c9f569..7560072 100644 --- a/crates/shirabe/src/util/platform.rs +++ b/crates/shirabe/src/util/platform.rs @@ -151,23 +151,21 @@ impl Platform { return Ok(home); } - if Self::is_windows() { - if let Some(home) = Self::get_env("USERPROFILE") { - return Ok(home); - } + if Self::is_windows() + && let Some(home) = Self::get_env("USERPROFILE") + { + return Ok(home); } if function_exists("posix_getuid") && function_exists("posix_getpwuid") { let info = posix_getpwuid(posix_getuid()); - if is_array(&info) { - if let Some(arr) = info.as_array() { - if let Some(dir) = arr.get("dir") { - if let Some(s) = dir.as_string() { - return Ok(s.to_string()); - } - } - } + if is_array(&info) + && let Some(arr) = info.as_array() + && let Some(dir) = arr.get("dir") + && let Some(s) = dir.as_string() + { + return Ok(s.to_string()); } } @@ -335,10 +333,10 @@ impl Platform { } // Check if formatted mode is S_IFCHR - if let Some(arr) = stat.as_array() { - if let Some(mode) = arr.get("mode").and_then(|v| v.as_int()) { - return 0o020000 == (mode & 0o170000); - } + if let Some(arr) = stat.as_array() + && let Some(mode) = arr.get("mode").and_then(|v| v.as_int()) + { + return 0o020000 == (mode & 0o170000); } false @@ -368,18 +366,16 @@ impl Platform { if function_exists("posix_getpwuid") && function_exists("posix_geteuid") { let process_user = posix_getpwuid(posix_geteuid()); - if is_array(&process_user) { - if let Some(arr) = process_user.as_array() { - if arr - .get("name") - .and_then(|v| v.as_string()) - .map(|s| s == "vagrant") - .unwrap_or(false) - { - *cached = Some(true); - return true; - } - } + if is_array(&process_user) + && let Some(arr) = process_user.as_array() + && arr + .get("name") + .and_then(|v| v.as_string()) + .map(|s| s == "vagrant") + .unwrap_or(false) + { + *cached = Some(true); + return true; } } -- cgit v1.3.1