Avoid pulling in std for no-std.

This commit is contained in:
Stephen Chung 2020-07-20 20:23:35 +08:00
parent 700060b6e7
commit a5fa8322e9
4 changed files with 8 additions and 0 deletions

View File

@ -46,6 +46,7 @@ codegen-units = 1
[dependencies.libm] [dependencies.libm]
version = "0.2.1" version = "0.2.1"
default_features = false
optional = true optional = true
[dependencies.core-error] [dependencies.core-error]

View File

@ -7,6 +7,9 @@ use crate::token::Position;
#[cfg(not(feature = "no_float"))] #[cfg(not(feature = "no_float"))]
use crate::parser::FLOAT; use crate::parser::FLOAT;
#[cfg(not(feature = "no_float"))]
use num_traits::*;
use num_traits::{ use num_traits::{
identities::Zero, CheckedAdd, CheckedDiv, CheckedMul, CheckedNeg, CheckedRem, CheckedShl, identities::Zero, CheckedAdd, CheckedDiv, CheckedMul, CheckedNeg, CheckedRem, CheckedShl,
CheckedShr, CheckedSub, CheckedShr, CheckedSub,

View File

@ -6,6 +6,9 @@ use crate::token::Position;
#[cfg(not(feature = "no_float"))] #[cfg(not(feature = "no_float"))]
use crate::parser::FLOAT; use crate::parser::FLOAT;
#[cfg(not(feature = "no_float"))]
use num_traits::*;
use crate::stdlib::{boxed::Box, format, i32, i64}; use crate::stdlib::{boxed::Box, format, i32, i64};
#[cfg(feature = "only_i32")] #[cfg(feature = "only_i32")]

View File

@ -608,6 +608,7 @@ impl Hash for CustomExpr {
#[derive(Debug, PartialEq, PartialOrd, Clone)] #[derive(Debug, PartialEq, PartialOrd, Clone)]
pub struct FloatWrapper(pub FLOAT, pub Position); pub struct FloatWrapper(pub FLOAT, pub Position);
#[cfg(not(feature = "no_float"))]
impl Hash for FloatWrapper { impl Hash for FloatWrapper {
fn hash<H: Hasher>(&self, state: &mut H) { fn hash<H: Hasher>(&self, state: &mut H) {
state.write(&self.0.to_le_bytes()); state.write(&self.0.to_le_bytes());