aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/util/platform.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-20 01:16:50 +0900
committernsfisis <nsfisis@gmail.com>2026-06-20 02:22:41 +0900
commitefec43b3b8827820cf35fe1b73d8e33f5fe84eb4 (patch)
treea62bbba72324de48be5f8e689559f8d9e288fc61 /crates/shirabe/src/util/platform.rs
parentcac18ef73a39b4ac41fa4d6ccb753804d4c42cb7 (diff)
downloadphp-shirabe-efec43b3b8827820cf35fe1b73d8e33f5fe84eb4.tar.gz
php-shirabe-efec43b3b8827820cf35fe1b73d8e33f5fe84eb4.tar.zst
php-shirabe-efec43b3b8827820cf35fe1b73d8e33f5fe84eb4.zip
refactor: auto-fix clippy warnings
Diffstat (limited to 'crates/shirabe/src/util/platform.rs')
-rw-r--r--crates/shirabe/src/util/platform.rs52
1 files changed, 24 insertions, 28 deletions
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;
}
}