ref: Simplify target cfgs (#1346)
This commit is contained in:
@@ -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)]
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user