From 651c42f11f6870dd2c23a1b33fed9ddefd043b76 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Sun, 23 Aug 2015 21:59:07 -0700 Subject: Make iter::order functions into methods on Iterator This does cause some breakage due to deficiencies in resolve - `path::Components` is both an `Iterator` and implements `Eq`, `Ord`, etc. If one calls e.g. `partial_cmp` on a `Components` and passes a `&Components` intending to target the `PartialOrd` impl, the compiler will select the `partial_cmp` from `Iterator` and then error out. I doubt anyone will run into breakage from `Components` specifically, but we should see if there are third party types that will run into issues. `iter::order::equals` wasn't moved to `Iterator` since it's exactly the same as `iter::order::eq` but with an `Eq` instead of `PartialEq` bound, which doensn't seem very useful. I also updated `le`, `gt`, etc to use `partial_cmp` which lets us drop the extra `PartialEq` bound. cc #27737 --- src/libcore/num/flt2dec/bignum.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/libcore/num') diff --git a/src/libcore/num/flt2dec/bignum.rs b/src/libcore/num/flt2dec/bignum.rs index ee1f6ffdd0a..ee2ffbffab6 100644 --- a/src/libcore/num/flt2dec/bignum.rs +++ b/src/libcore/num/flt2dec/bignum.rs @@ -448,12 +448,10 @@ macro_rules! define_bignum { impl ::cmp::Ord for $name { fn cmp(&self, other: &$name) -> ::cmp::Ordering { use cmp::max; - use iter::order; - let sz = max(self.size, other.size); let lhs = self.base[..sz].iter().cloned().rev(); let rhs = other.base[..sz].iter().cloned().rev(); - order::cmp(lhs, rhs) + lhs.cmp(rhs) } } -- cgit 1.4.1-3-g733a5