Default to false for tests regardless of the OS

Checking for username along with cfg!(test) seems redundant, especially because of one edge case - root user can be renamed
This commit is contained in:
Chiffa 2024-10-29 16:23:10 +03:00
parent 44140502f3
commit 9628e133f6

View File

@ -109,12 +109,12 @@ fn is_root_user() -> bool {
)
}
#[cfg(all(target_os = "windows", test))]
#[cfg(test)]
fn is_root_user() -> bool {
false
}
#[cfg(not(target_os = "windows"))]
#[cfg(all(not(target_os = "windows"), not(test)))]
fn is_root_user() -> bool {
nix::unistd::geteuid() == nix::unistd::ROOT
}