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;
#[cfg(unix)]
pub mod unix;
#[cfg(target_os = "windows")]
#[cfg(windows)]
pub mod windows;
#[cfg(windows)]

View File

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