RangeInclusive{range: range(start, stop), done: false}
}
-impl<A: Add<A, A> + Eq + Ord + Clone + ToPrimitive> Iterator<A> for RangeInclusive<A> {
+impl<A: Add<A, A> + Ord + Clone + ToPrimitive> Iterator<A> for RangeInclusive<A> {
#[inline]
fn next(&mut self) -> Option<A> {
match self.range.next() {
}
/// Return `a` < `b` lexicographically (Using partial order, `Ord`)
- pub fn lt<A: Eq + Ord, T: Iterator<A>>(mut a: T, mut b: T) -> bool {
+ pub fn lt<A: Ord, T: Iterator<A>>(mut a: T, mut b: T) -> bool {
loop {
match (a.next(), b.next()) {
(None, None) => return false,
}
/// Return `a` <= `b` lexicographically (Using partial order, `Ord`)
- pub fn le<A: Eq + Ord, T: Iterator<A>>(mut a: T, mut b: T) -> bool {
+ pub fn le<A: Ord, T: Iterator<A>>(mut a: T, mut b: T) -> bool {
loop {
match (a.next(), b.next()) {
(None, None) => return true,
}
/// Return `a` > `b` lexicographically (Using partial order, `Ord`)
- pub fn gt<A: Eq + Ord, T: Iterator<A>>(mut a: T, mut b: T) -> bool {
+ pub fn gt<A: Ord, T: Iterator<A>>(mut a: T, mut b: T) -> bool {
loop {
match (a.next(), b.next()) {
(None, None) => return false,
}
/// Return `a` >= `b` lexicographically (Using partial order, `Ord`)
- pub fn ge<A: Eq + Ord, T: Iterator<A>>(mut a: T, mut b: T) -> bool {
+ pub fn ge<A: Ord, T: Iterator<A>>(mut a: T, mut b: T) -> bool {
loop {
match (a.next(), b.next()) {
(None, None) => return true,
}
}
+ impl Eq for Foo {
+ fn eq(&self, _: &Foo) -> bool {
+ true
+ }
+ }
+
impl Ord for Foo {
fn lt(&self, _: &Foo) -> bool {
false