diff options
Diffstat (limited to 'src/libnum')
| -rw-r--r-- | src/libnum/bigint.rs | 10 | ||||
| -rw-r--r-- | src/libnum/rational.rs | 3 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/libnum/bigint.rs b/src/libnum/bigint.rs index 06e4792cdcc..cc3753def59 100644 --- a/src/libnum/bigint.rs +++ b/src/libnum/bigint.rs @@ -91,8 +91,8 @@ impl Eq for BigUint {} impl PartialOrd for BigUint { #[inline] - fn lt(&self, other: &BigUint) -> bool { - self.cmp(other) == Less + fn partial_cmp(&self, other: &BigUint) -> Option<Ordering> { + Some(self.cmp(other)) } } @@ -215,7 +215,7 @@ impl Sub<BigUint, BigUint> for BigUint { let zeros = ZERO_VEC.iter().cycle(); let (a, b) = (self.data.iter().chain(zeros.clone()), other.data.iter().chain(zeros)); - let mut borrow = 0; + let mut borrow = 0i; let diff: Vec<BigDigit> = a.take(new_len).zip(b).map(|(ai, bi)| { let (hi, lo) = BigDigit::from_doublebigdigit( BigDigit::base @@ -816,8 +816,8 @@ impl Eq for BigInt {} impl PartialOrd for BigInt { #[inline] - fn lt(&self, other: &BigInt) -> bool { - self.cmp(other) == Less + fn partial_cmp(&self, other: &BigInt) -> Option<Ordering> { + Some(self.cmp(other)) } } diff --git a/src/libnum/rational.rs b/src/libnum/rational.rs index 971b6b1b51b..9a455edf2c0 100644 --- a/src/libnum/rational.rs +++ b/src/libnum/rational.rs @@ -193,7 +193,8 @@ macro_rules! cmp_impl { }; } cmp_impl!(impl PartialEq, eq, ne) -cmp_impl!(impl PartialOrd, lt, gt, le, ge) +cmp_impl!(impl PartialOrd, lt -> bool, gt -> bool, le -> bool, ge -> bool, + partial_cmp -> Option<cmp::Ordering>) cmp_impl!(impl Eq, ) cmp_impl!(impl Ord, cmp -> cmp::Ordering) |
