diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2019-09-24 12:13:35 -0700 |
|---|---|---|
| committer | gnzlbg <gnzlbg@users.noreply.github.com> | 2019-10-10 12:43:27 +0200 |
| commit | 036b6348d9ec5ef0a5d58cebc6b160f25e1d6df3 (patch) | |
| tree | 1ee63904c412f632d312d34dd376d6ef3b5d3df2 /library/stdarch/crates/std_detect/src/detect/mod.rs | |
| parent | cd7aa7720ab8b6b0efce3bdd4b8d79e19b4ad473 (diff) | |
| download | rust-036b6348d9ec5ef0a5d58cebc6b160f25e1d6df3.tar.gz rust-036b6348d9ec5ef0a5d58cebc6b160f25e1d6df3.zip | |
Remove need for `#[macro_use]` with `cfg-if`
Modernizes usage of `cfg_if!` slightly
Diffstat (limited to 'library/stdarch/crates/std_detect/src/detect/mod.rs')
| -rw-r--r-- | library/stdarch/crates/std_detect/src/detect/mod.rs | 21 |
1 files changed, 9 insertions, 12 deletions
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_() } |
