aboutsummaryrefslogtreecommitdiffstats
path: root/components/util/sort.rs
diff options
context:
space:
mode:
authorMs2ger <ms2ger@gmail.com>2015-01-22 13:25:07 +0100
committerMs2ger <ms2ger@gmail.com>2015-01-22 14:49:25 +0100
commit524966e3af8fbc871005cef460dc86c379a36034 (patch)
tree7975a1eb769f4bb430a886423666bc4ad67f9ddd /components/util/sort.rs
parent59bca2962c19f653eec835fc54caf1a3eadcb906 (diff)
downloadservo-524966e3af8fbc871005cef460dc86c379a36034.tar.gz
servo-524966e3af8fbc871005cef460dc86c379a36034.zip
Use std::cmp::Ordering explicitly.
Diffstat (limited to 'components/util/sort.rs')
-rw-r--r--components/util/sort.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/components/util/sort.rs b/components/util/sort.rs
index 73a244f713f..d31948cb0e8 100644
--- a/components/util/sort.rs
+++ b/components/util/sort.rs
@@ -4,6 +4,8 @@
//! In-place sorting.
+use std::cmp::Ordering;
+
fn quicksort_helper<T>(arr: &mut [T], left: int, right: int, compare: fn(&T, &T) -> Ordering) {
if right <= left {
return
@@ -17,11 +19,11 @@ fn quicksort_helper<T>(arr: &mut [T], left: int, right: int, compare: fn(&T, &T)
let v: *mut T = &mut arr[right as uint];
loop {
i += 1;
- while compare(&arr[i as uint], &*v) == Less {
+ while compare(&arr[i as uint], &*v) == Ordering::Less {
i += 1
}
j -= 1;
- while compare(&*v, &arr[j as uint]) == Less {
+ while compare(&*v, &arr[j as uint]) == Ordering::Less {
if j == left {
break
}
@@ -31,11 +33,11 @@ fn quicksort_helper<T>(arr: &mut [T], left: int, right: int, compare: fn(&T, &T)
break
}
arr.swap(i as uint, j as uint);
- if compare(&arr[i as uint], &*v) == Equal {
+ if compare(&arr[i as uint], &*v) == Ordering::Equal {
p += 1;
arr.swap(p as uint, i as uint)
}
- if compare(&*v, &arr[j as uint]) == Equal {
+ if compare(&*v, &arr[j as uint]) == Ordering::Equal {
q -= 1;
arr.swap(j as uint, q as uint)
}