Skip to content

Commit ececbb2

Browse files
author
Stjepan Glavina
committed
Simplify by calling SliceOrd::compare
1 parent 3bd6e46 commit ececbb2

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

src/libcore/slice.rs

+1-15
Original file line numberDiff line numberDiff line change
@@ -2294,21 +2294,7 @@ impl<A> SlicePartialOrd<A> for [A]
22942294
where A: Ord
22952295
{
22962296
default fn partial_compare(&self, other: &[A]) -> Option<Ordering> {
2297-
let l = cmp::min(self.len(), other.len());
2298-
2299-
// Slice to the loop iteration range to enable bound check
2300-
// elimination in the compiler
2301-
let lhs = &self[..l];
2302-
let rhs = &other[..l];
2303-
2304-
for i in 0..l {
2305-
match lhs[i].cmp(&rhs[i]) {
2306-
Ordering::Equal => (),
2307-
non_eq => return Some(non_eq),
2308-
}
2309-
}
2310-
2311-
self.len().partial_cmp(&other.len())
2297+
Some(SliceOrd::compare(self, other))
23122298
}
23132299
}
23142300

0 commit comments

Comments
 (0)