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