ref: Simplify target cfgs (#1346)

This commit is contained in:
Gideon
2025-11-08 11:04:52 +01:00
committed by GitHub
parent 5866a0570f
commit 6c68bfaf64
2 changed files with 3 additions and 3 deletions

View File

@@ -14,7 +14,7 @@ pub mod macos;
pub mod openbsd; pub mod openbsd;
#[cfg(unix)] #[cfg(unix)]
pub mod unix; pub mod unix;
#[cfg(target_os = "windows")] #[cfg(windows)]
pub mod windows; pub mod windows;
#[cfg(windows)] #[cfg(windows)]

View File

@@ -151,7 +151,7 @@ pub fn string_prepend_str(string: &mut String, s: &str) {
*string = new_string; *string = new_string;
} }
#[cfg(target_family = "unix")] #[cfg(unix)]
pub fn hostname() -> Result<String> { pub fn hostname() -> Result<String> {
match nix::unistd::gethostname() { match nix::unistd::gethostname() {
Ok(os_str) => Ok(os_str Ok(os_str) => Ok(os_str
@@ -161,7 +161,7 @@ pub fn hostname() -> Result<String> {
} }
} }
#[cfg(target_family = "windows")] #[cfg(windows)]
pub fn hostname() -> Result<String> { pub fn hostname() -> Result<String> {
Command::new("hostname") Command::new("hostname")
.output_checked_utf8() .output_checked_utf8()