diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index 18244cec7c7..7d052c218fe 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -2294,21 +2294,7 @@ impl SlicePartialOrd for [A] where A: Ord { default fn partial_compare(&self, other: &[A]) -> Option { - let l = cmp::min(self.len(), other.len()); - - // Slice to the loop iteration range to enable bound check - // elimination in the compiler - let lhs = &self[..l]; - let rhs = &other[..l]; - - for i in 0..l { - match lhs[i].cmp(&rhs[i]) { - Ordering::Equal => (), - non_eq => return Some(non_eq), - } - } - - self.len().partial_cmp(&other.len()) + Some(SliceOrd::compare(self, other)) } }