diff options
| author | Erick Tryzelaar <erick.tryzelaar@gmail.com> | 2012-11-17 19:43:02 -0800 |
|---|---|---|
| committer | Graydon Hoare <graydon@mozilla.com> | 2012-11-20 16:39:30 -0800 |
| commit | e1a552a628f13d8325f680327645ee0f446d250c (patch) | |
| tree | 63f3b48864656e34fda9522e316fd19fd86bd454 /src/libstd/sort.rs | |
| parent | e70b4818032176d266be5f8030a7abb26c375228 (diff) | |
| download | rust-e1a552a628f13d8325f680327645ee0f446d250c.tar.gz rust-e1a552a628f13d8325f680327645ee0f446d250c.zip | |
libstd: fix warnings in sort
Diffstat (limited to 'src/libstd/sort.rs')
| -rw-r--r-- | src/libstd/sort.rs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/libstd/sort.rs b/src/libstd/sort.rs index 1d4476c2a2a..73529fd2a93 100644 --- a/src/libstd/sort.rs +++ b/src/libstd/sort.rs @@ -45,9 +45,9 @@ pub pure fn merge_sort<T: Copy>(v: &[const T], le: Le<T>) -> ~[T] { a_ix += 1; } else { rs.push(b[b_ix]); b_ix += 1; } } - rs = vec::append(rs, vec::slice(a, a_ix, a_len)); - rs = vec::append(rs, vec::slice(b, b_ix, b_len)); - return rs; + rs.push_all(vec::slice(a, a_ix, a_len)); + rs.push_all(vec::slice(b, b_ix, b_len)); + move rs } } @@ -786,11 +786,11 @@ mod test_qsort { let expected = ~[1, 2, 3]; - do sort::quick_sort(names) |x, y| { int::le(*x, *y) }; + do quick_sort(names) |x, y| { int::le(*x, *y) }; let immut_names = vec::from_mut(move names); - let pairs = vec::zip(expected, immut_names); + let pairs = vec::zip_slice(expected, immut_names); for vec::each(pairs) |p| { let (a, b) = *p; debug!("%d %d", a, b); @@ -867,7 +867,7 @@ mod tests { #[cfg(test)] mod test_tim_sort { struct CVal { - val: ~float, + val: float, } impl CVal: Ord { @@ -948,14 +948,14 @@ mod test_tim_sort { let rng = rand::Rng(); let mut arr = do vec::from_fn(1000) |_i| { let randVal = rng.gen_float(); - CVal { val: ~randVal } + CVal { val: randVal } }; tim_sort(arr); fail ~"Guarantee the fail"; } - struct DVal { val: ~uint } + struct DVal { val: uint } #[cfg(stage0)] impl DVal: Ord { @@ -979,7 +979,7 @@ mod test_tim_sort { let rng = rand::Rng(); let mut arr = do vec::from_fn(500) |_i| { let randVal = rng.gen_uint(); - DVal { val: ~randVal } + DVal { val: randVal } }; tim_sort(arr); @@ -1032,7 +1032,7 @@ mod big_tests { for uint::range(lo, hi) |i| { let n = 1 << i; let arr = do vec::from_fn(n) |_i| { - ~rng.gen_float() + rng.gen_float() }; let arr = vec::to_mut(move arr); @@ -1058,7 +1058,7 @@ mod big_tests { let size = arr.len(); let mut idx = 1; while idx <= 10 { - arr[size-idx] = ~rng.gen_float(); + arr[size-idx] = rng.gen_float(); idx += 1; } } @@ -1067,7 +1067,7 @@ mod big_tests { for (n/100).times { let idx = rng.gen_uint_range(0, n); - arr[idx] = ~rng.gen_float(); + arr[idx] = rng.gen_float(); } tim_sort(arr); isSorted(arr); @@ -1079,12 +1079,12 @@ mod big_tests { tim_sort(arr); // ~sort isSorted(arr); - let mut arr = vec::from_elem(n, ~(-0.5)); + let mut arr = vec::from_elem(n, -0.5); tim_sort(arr); // =sort isSorted(arr); let half = n / 2; - let mut arr = makeRange(half).map(|i| ~(*i as float)); + let mut arr = makeRange(half).map(|i| *i as float); tim_sort(arr); // !sort isSorted(arr); } |
