diff --git a/src/float.rs b/src/float.rs index f4cb6fc..6f12b56 100644 --- a/src/float.rs +++ b/src/float.rs @@ -7,7 +7,7 @@ use core::f64; use {Num, NumCast, ToPrimitive}; -#[cfg(feature = "libm")] +#[cfg(all(not(feature = "std"), feature = "libm"))] use libm::{F32Ext, F64Ext}; /// Generic trait for floating point numbers that works with `no_std`. @@ -1887,7 +1887,7 @@ macro_rules! float_impl_std { }; } -#[cfg(feature = "libm")] +#[cfg(all(not(feature = "std"), feature = "libm"))] macro_rules! float_impl_libm { ($T:ident $decode:ident $LibmImpl:ident) => { impl Float for $T { diff --git a/src/lib.rs b/src/lib.rs index ce2874e..559a18c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -20,7 +20,8 @@ #[cfg(feature = "std")] extern crate std; -#[cfg(feature = "libm")] +// Only `no_std` builds actually use `libm`. +#[cfg(all(not(feature = "std"), feature = "libm"))] extern crate libm; use core::fmt;