Auto merge of #36310 - jstnlef:remove-extraneous-not-equal-impl, r=sfackler

Removing the extraneous not_equal implementation for slices

Happened to stumble upon this one awhile back. Seemed a bit silly to have both the equals and not equals implementation when they're so similar.
This commit is contained in:
bors 2016-09-07 22:30:48 -07:00 committed by GitHub
commit a5dbf8a0f8

View File

@ -1821,7 +1821,8 @@ fn partial_cmp(&self, other: &[T]) -> Option<Ordering> {
// 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
@ -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
@ -1874,10 +1861,6 @@ fn equal(&self, other: &[A]) -> bool {
other.as_ptr() as *const u8, size) == 0
}
}
fn not_equal(&self, other: &[A]) -> bool {
!self.equal(other)
}
}
#[doc(hidden)]