aboutsummaryrefslogtreecommitdiffstats
path: root/components/util
diff options
context:
space:
mode:
Diffstat (limited to 'components/util')
-rw-r--r--components/util/smallvec.rs8
-rw-r--r--components/util/sort.rs4
-rw-r--r--components/util/vec.rs10
3 files changed, 11 insertions, 11 deletions
diff --git a/components/util/smallvec.rs b/components/util/smallvec.rs
index 998f8ef1d57..5185c4ee521 100644
--- a/components/util/smallvec.rs
+++ b/components/util/smallvec.rs
@@ -498,7 +498,7 @@ pub mod tests {
let mut v = SmallVec16::new();
v.push("hello".to_string());
v.push("there".to_string());
- assert_eq!(v.as_slice(), &["hello".to_string(), "there".to_string()]);
+ assert_eq!(v.as_slice(), vec!["hello".to_string(), "there".to_string()].as_slice());
}
#[test]
@@ -508,7 +508,7 @@ pub mod tests {
v.push("there".to_string());
v.push("burma".to_string());
v.push("shave".to_string());
- assert_eq!(v.as_slice(), &["hello".to_string(), "there".to_string(), "burma".to_string(), "shave".to_string()]);
+ assert_eq!(v.as_slice(), vec!["hello".to_string(), "there".to_string(), "burma".to_string(), "shave".to_string()].as_slice());
}
#[test]
@@ -522,9 +522,9 @@ pub mod tests {
v.push("there".to_string());
v.push("burma".to_string());
v.push("shave".to_string());
- assert_eq!(v.as_slice(), &[
+ assert_eq!(v.as_slice(), vec![
"hello".to_string(), "there".to_string(), "burma".to_string(), "shave".to_string(), "hello".to_string(), "there".to_string(), "burma".to_string(), "shave".to_string(),
- ]);
+ ].as_slice());
}
}
diff --git a/components/util/sort.rs b/components/util/sort.rs
index bf0c37d8ea6..73a244f713f 100644
--- a/components/util/sort.rs
+++ b/components/util/sort.rs
@@ -91,9 +91,9 @@ pub mod test {
let len: uint = rng.gen();
let mut v: Vec<int> = rng.gen_iter::<int>().take((len % 32) + 1).collect();
fn compare_ints(a: &int, b: &int) -> Ordering { a.cmp(b) }
- sort::quicksort_by(v.as_slice_mut(), compare_ints);
+ sort::quicksort_by(v.as_mut_slice(), compare_ints);
for i in range(0, v.len() - 1) {
- assert!(v.get(i) <= v.get(i + 1))
+ assert!(v[i] <= v[i + 1])
}
}
}
diff --git a/components/util/vec.rs b/components/util/vec.rs
index b8d24687d28..61fd05fe0c5 100644
--- a/components/util/vec.rs
+++ b/components/util/vec.rs
@@ -11,7 +11,7 @@ pub trait Comparator<K,T> {
}
pub trait BinarySearchMethods<'a, T: Ord + PartialOrd + PartialEq> {
- fn binary_search(&self, key: &T) -> Option<&'a T>;
+ fn binary_search_(&self, key: &T) -> Option<&'a T>;
fn binary_search_index(&self, key: &T) -> Option<uint>;
}
@@ -20,7 +20,7 @@ pub trait FullBinarySearchMethods<T> {
}
impl<'a, T: Ord + PartialOrd + PartialEq> BinarySearchMethods<'a, T> for &'a [T] {
- fn binary_search(&self, key: &T) -> Option<&'a T> {
+ fn binary_search_(&self, key: &T) -> Option<&'a T> {
self.binary_search_index(key).map(|i| &self[i])
}
@@ -65,7 +65,7 @@ impl<T:PartialEq + PartialOrd + Ord> Comparator<T,T> for DefaultComparator {
fn test_find_all_elems<T: PartialEq + PartialOrd + Eq + Ord>(arr: &[T]) {
let mut i = 0;
while i < arr.len() {
- assert!(test_match(&arr[i], arr.binary_search(&arr[i])));
+ assert!(test_match(&arr[i], arr.binary_search_(&arr[i])));
i += 1;
}
}
@@ -74,9 +74,9 @@ fn test_find_all_elems<T: PartialEq + PartialOrd + Eq + Ord>(arr: &[T]) {
fn test_miss_all_elems<T: PartialEq + PartialOrd + Eq + Ord>(arr: &[T], misses: &[T]) {
let mut i = 0;
while i < misses.len() {
- let res = arr.binary_search(&misses[i]);
+ let res = arr.binary_search_(&misses[i]);
debug!("{:?} == {:?} ?", misses[i], res);
- assert!(!test_match(&misses[i], arr.binary_search(&misses[i])));
+ assert!(!test_match(&misses[i], arr.binary_search_(&misses[i])));
i += 1;
}
}