diff --git a/src/lexical/num.rs b/src/lexical/num.rs index 03b89ca..3b945db 100644 --- a/src/lexical/num.rs +++ b/src/lexical/num.rs @@ -47,7 +47,7 @@ const F64_POW10: [f64; 23] = [ ]; /// Type that can be converted to primitive with `as`. -pub trait AsPrimitive: Sized + Copy + PartialEq + PartialOrd + Send + Sync { +pub trait AsPrimitive: Sized + Copy + PartialOrd { fn as_u32(self) -> u32; fn as_u64(self) -> u64; fn as_u128(self) -> u128; @@ -129,20 +129,7 @@ as_cast_impl!(f32, as_f32); as_cast_impl!(f64, as_f64); /// Numerical type trait. -pub trait Number: - AsCast - + ops::Add - + ops::AddAssign - + ops::Div - + ops::DivAssign - + ops::Mul - + ops::MulAssign - + ops::Rem - + ops::RemAssign - + ops::Sub - + ops::SubAssign -{ -} +pub trait Number: AsCast + ops::Add {} macro_rules! number_impl { ($($ty:ident)*) => { @@ -155,9 +142,7 @@ macro_rules! number_impl { number_impl! { u32 u64 u128 usize i32 f32 f64 } /// Defines a trait that supports integral operations. -pub trait Integer: - Number + ops::BitAnd + ops::BitAndAssign + ops::Shr -{ +pub trait Integer: Number + ops::BitAnd + ops::Shr { const ZERO: Self; } @@ -195,7 +180,7 @@ impl Mantissa for u64 { } /// Get exact exponent limit for radix. -pub trait Float: Number + ops::Neg { +pub trait Float: Number { /// Unsigned type of the same size. type Unsigned: Integer; diff --git a/tests/lexical/num.rs b/tests/lexical/num.rs index 1edfbb5..58b9eac 100644 --- a/tests/lexical/num.rs +++ b/tests/lexical/num.rs @@ -21,7 +21,7 @@ fn as_primitive_test() { check_as_primitive(1f64); } -fn check_number(x: T, mut y: T) { +fn check_number(x: T, y: T) { // Copy, partialeq, partialord let _ = x; assert!(x < y); @@ -29,15 +29,6 @@ fn check_number(x: T, mut y: T) { // Operations let _ = y + x; - let _ = y - x; - let _ = y * x; - let _ = y / x; - let _ = y % x; - y += x; - y -= x; - y *= x; - y /= x; - y %= x; // Conversions already tested. }