From c4256bd4df98d113e3062063e606311307a150c3 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 27 Sep 2019 10:53:12 -0700 Subject: [PATCH] Don't use libm at all with std --- src/float.rs | 4 ++-- src/lib.rs | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) 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;