diff options
Diffstat (limited to 'library/stdarch/crates/std_detect/src')
4 files changed, 12 insertions, 18 deletions
diff --git a/library/stdarch/crates/std_detect/src/detect/cache.rs b/library/stdarch/crates/std_detect/src/detect/cache.rs index 9179fbd9389..fe2abf5cf5e 100644 --- a/library/stdarch/crates/std_detect/src/detect/cache.rs +++ b/library/stdarch/crates/std_detect/src/detect/cache.rs @@ -158,7 +158,7 @@ impl Cache { self.1.store(hi, Ordering::Relaxed); } } -cfg_if! { +cfg_if::cfg_if! { if #[cfg(feature = "std_detect_env_override")] { #[inline(never)] fn initialize(mut value: Initializer) { diff --git a/library/stdarch/crates/std_detect/src/detect/mod.rs b/library/stdarch/crates/std_detect/src/detect/mod.rs index 78b37019154..e8b5b3e3b5f 100644 --- a/library/stdarch/crates/std_detect/src/detect/mod.rs +++ b/library/stdarch/crates/std_detect/src/detect/mod.rs @@ -17,6 +17,8 @@ //! due to security concerns (x86 is the big exception). These functions are //! implemented in the `os/{target_os}.rs` modules. +use cfg_if::cfg_if; + #[macro_use] mod error_macros; @@ -132,19 +134,14 @@ pub fn features() -> impl Iterator<Item = (&'static str, bool)> { target_arch = "mips", target_arch = "mips64", ))] { - fn impl_() -> impl Iterator<Item=(&'static str, bool)> { - (0_u8..Feature::_last as u8).map(|discriminant: u8| { - let f: Feature = unsafe { crate::mem::transmute(discriminant) }; - let name: &'static str = f.to_str(); - let enabled: bool = check_for(f); - (name, enabled) - }) - } + (0_u8..Feature::_last as u8).map(|discriminant: u8| { + let f: Feature = unsafe { crate::mem::transmute(discriminant) }; + let name: &'static str = f.to_str(); + let enabled: bool = check_for(f); + (name, enabled) + }) } else { - fn impl_() -> impl Iterator<Item=(&'static str, bool)> { - (0_u8..0_u8).map(|_x: u8| ("", false)) - } + None.into_iter() } } - impl_() } diff --git a/library/stdarch/crates/std_detect/src/detect/os/freebsd/mod.rs b/library/stdarch/crates/std_detect/src/detect/os/freebsd/mod.rs index 1a5338a3555..4321bce74dd 100644 --- a/library/stdarch/crates/std_detect/src/detect/os/freebsd/mod.rs +++ b/library/stdarch/crates/std_detect/src/detect/os/freebsd/mod.rs @@ -2,7 +2,7 @@ mod auxvec; -cfg_if! { +cfg_if::cfg_if! { if #[cfg(target_arch = "aarch64")] { mod aarch64; pub use self::aarch64::check_for; diff --git a/library/stdarch/crates/std_detect/src/lib.rs b/library/stdarch/crates/std_detect/src/lib.rs index bb70baaf61a..88a00e40aac 100644 --- a/library/stdarch/crates/std_detect/src/lib.rs +++ b/library/stdarch/crates/std_detect/src/lib.rs @@ -20,10 +20,7 @@ #![cfg_attr(test, allow(unused_imports))] #![no_std] -#[macro_use] -extern crate cfg_if; - -cfg_if! { +cfg_if::cfg_if! { if #[cfg(any(feature = "std_detect_file_io", feature = "std_detect_env_override"))] { #[cfg_attr(test, macro_use(println))] extern crate std; |
