Skip to content

Commit 5e26c0c

Browse files
committed
Only impl std traits if feature is specified
1 parent 9668768 commit 5e26c0c

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

src/lib.rs

+9-14
Original file line numberDiff line numberDiff line change
@@ -160,20 +160,15 @@ pub use crate::error::Error;
160160
#[allow(dead_code)]
161161
mod util;
162162

163-
cfg_if! {
164-
// Unlike the other Unix, Fuchsia and iOS don't use the libc to make any calls.
165-
if #[cfg(any(target_os = "android", target_os = "dragonfly", target_os = "emscripten",
166-
target_os = "freebsd", target_os = "haiku", target_os = "illumos",
167-
target_os = "linux", target_os = "macos", target_os = "netbsd",
168-
target_os = "openbsd", target_os = "redox", target_os = "solaris"))] {
169-
#[allow(dead_code)]
170-
mod util_libc;
171-
// Keep std-only trait definitions for backwards compatiblity
172-
mod error_impls;
173-
} else if #[cfg(feature = "std")] {
174-
mod error_impls;
175-
}
176-
}
163+
#[cfg(all(
164+
unix,
165+
not(any(target_os = "ios", target_os = "fuchsia", target_os = "hermit"))
166+
))]
167+
#[allow(dead_code)]
168+
mod util_libc;
169+
170+
#[cfg(feature = "std")]
171+
mod error_impls;
177172

178173
// These targets read from a file as a fallback method.
179174
#[cfg(any(

0 commit comments

Comments
 (0)