Skip to content

Commit

Permalink
remove the extraneous not_equal implementation for slices.
Browse files Browse the repository at this point in the history
  • Loading branch information
jstnlef committed Sep 7, 2016
1 parent 923bac4 commit a77b55d
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions src/libcore/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1821,7 +1821,8 @@ impl<T: PartialOrd> PartialOrd for [T] {
// intermediate trait for specialization of slice's PartialEq
trait SlicePartialEq<B> {
fn equal(&self, other: &[B]) -> bool;
fn not_equal(&self, other: &[B]) -> bool;

fn not_equal(&self, other: &[B]) -> bool { !self.equal(other) }
}

// Generic slice equality
Expand All @@ -1841,20 +1842,6 @@ impl<A, B> SlicePartialEq<B> for [A]

true
}

default fn not_equal(&self, other: &[B]) -> bool {
if self.len() != other.len() {
return true;
}

for i in 0..self.len() {
if self[i].ne(&other[i]) {
return true;
}
}

false
}
}

// Use memcmp for bytewise equality when the types allow
Expand All @@ -1874,10 +1861,6 @@ impl<A> SlicePartialEq<A> for [A]
other.as_ptr() as *const u8, size) == 0
}
}

fn not_equal(&self, other: &[A]) -> bool {
!self.equal(other)
}
}

#[doc(hidden)]
Expand Down

0 comments on commit a77b55d

Please sign in to comment.