We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3bd6e46 commit ececbb2Copy full SHA for ececbb2
src/libcore/slice.rs
@@ -2294,21 +2294,7 @@ impl<A> SlicePartialOrd<A> for [A]
2294
where A: Ord
2295
{
2296
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())
+ Some(SliceOrd::compare(self, other))
2312
}
2313
2314
0 commit comments