summary refs log tree commit diff
path: root/src/libcore/num
diff options
context:
space:
mode:
authorSteven Fackler <sfackler@gmail.com>2015-08-23 21:59:07 -0700
committerSteven Fackler <sfackler@gmail.com>2015-08-26 23:23:57 -0700
commit651c42f11f6870dd2c23a1b33fed9ddefd043b76 (patch)
tree80884384f083c5f4118068944d3168bf86ae0a0b /src/libcore/num
parent63ba780fd7ab506bfd0f92d34a39172b412cfbe1 (diff)
downloadrust-651c42f11f6870dd2c23a1b33fed9ddefd043b76.tar.gz
rust-651c42f11f6870dd2c23a1b33fed9ddefd043b76.zip
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
Diffstat (limited to 'src/libcore/num')
-rw-r--r--src/libcore/num/flt2dec/bignum.rs4
1 files changed, 1 insertions, 3 deletions
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)
             }
         }