about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-09-07 22:30:48 -0700
committerGitHub <noreply@github.com>2016-09-07 22:30:48 -0700
commita5dbf8a0f8843c5466c3866cc2a288c0ef7051d2 (patch)
tree2153a43147c0c62b5bb8112320d2c3c25b051dcb
parent4a262862167899ae33e65af19fa4e34f787e4b8c (diff)
parenta77b55d58f9b173b1e4fb96bb6935fadbfda3240 (diff)
downloadrust-a5dbf8a0f8843c5466c3866cc2a288c0ef7051d2.tar.gz
rust-a5dbf8a0f8843c5466c3866cc2a288c0ef7051d2.zip
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.
-rw-r--r--src/libcore/slice.rs21
1 files changed, 2 insertions, 19 deletions
diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs
index baa41aa7af5..b22bdb43414 100644
--- a/src/libcore/slice.rs
+++ b/src/libcore/slice.rs
@@ -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
@@ -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 @@ 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)]