Skip to content

Commit e1a552a

Browse files
ericktgraydon
authored andcommitted
libstd: fix warnings in sort
1 parent e70b481 commit e1a552a

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/libstd/sort.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ pub pure fn merge_sort<T: Copy>(v: &[const T], le: Le<T>) -> ~[T] {
4545
a_ix += 1;
4646
} else { rs.push(b[b_ix]); b_ix += 1; }
4747
}
48-
rs = vec::append(rs, vec::slice(a, a_ix, a_len));
49-
rs = vec::append(rs, vec::slice(b, b_ix, b_len));
50-
return rs;
48+
rs.push_all(vec::slice(a, a_ix, a_len));
49+
rs.push_all(vec::slice(b, b_ix, b_len));
50+
move rs
5151
}
5252
}
5353

@@ -786,11 +786,11 @@ mod test_qsort {
786786

787787
let expected = ~[1, 2, 3];
788788

789-
do sort::quick_sort(names) |x, y| { int::le(*x, *y) };
789+
do quick_sort(names) |x, y| { int::le(*x, *y) };
790790

791791
let immut_names = vec::from_mut(move names);
792792

793-
let pairs = vec::zip(expected, immut_names);
793+
let pairs = vec::zip_slice(expected, immut_names);
794794
for vec::each(pairs) |p| {
795795
let (a, b) = *p;
796796
debug!("%d %d", a, b);
@@ -867,7 +867,7 @@ mod tests {
867867
#[cfg(test)]
868868
mod test_tim_sort {
869869
struct CVal {
870-
val: ~float,
870+
val: float,
871871
}
872872

873873
impl CVal: Ord {
@@ -948,14 +948,14 @@ mod test_tim_sort {
948948
let rng = rand::Rng();
949949
let mut arr = do vec::from_fn(1000) |_i| {
950950
let randVal = rng.gen_float();
951-
CVal { val: ~randVal }
951+
CVal { val: randVal }
952952
};
953953

954954
tim_sort(arr);
955955
fail ~"Guarantee the fail";
956956
}
957957

958-
struct DVal { val: ~uint }
958+
struct DVal { val: uint }
959959

960960
#[cfg(stage0)]
961961
impl DVal: Ord {
@@ -979,7 +979,7 @@ mod test_tim_sort {
979979
let rng = rand::Rng();
980980
let mut arr = do vec::from_fn(500) |_i| {
981981
let randVal = rng.gen_uint();
982-
DVal { val: ~randVal }
982+
DVal { val: randVal }
983983
};
984984

985985
tim_sort(arr);
@@ -1032,7 +1032,7 @@ mod big_tests {
10321032
for uint::range(lo, hi) |i| {
10331033
let n = 1 << i;
10341034
let arr = do vec::from_fn(n) |_i| {
1035-
~rng.gen_float()
1035+
rng.gen_float()
10361036
};
10371037
let arr = vec::to_mut(move arr);
10381038

@@ -1058,7 +1058,7 @@ mod big_tests {
10581058
let size = arr.len();
10591059
let mut idx = 1;
10601060
while idx <= 10 {
1061-
arr[size-idx] = ~rng.gen_float();
1061+
arr[size-idx] = rng.gen_float();
10621062
idx += 1;
10631063
}
10641064
}
@@ -1067,7 +1067,7 @@ mod big_tests {
10671067

10681068
for (n/100).times {
10691069
let idx = rng.gen_uint_range(0, n);
1070-
arr[idx] = ~rng.gen_float();
1070+
arr[idx] = rng.gen_float();
10711071
}
10721072
tim_sort(arr);
10731073
isSorted(arr);
@@ -1079,12 +1079,12 @@ mod big_tests {
10791079
tim_sort(arr); // ~sort
10801080
isSorted(arr);
10811081

1082-
let mut arr = vec::from_elem(n, ~(-0.5));
1082+
let mut arr = vec::from_elem(n, -0.5);
10831083
tim_sort(arr); // =sort
10841084
isSorted(arr);
10851085

10861086
let half = n / 2;
1087-
let mut arr = makeRange(half).map(|i| ~(*i as float));
1087+
let mut arr = makeRange(half).map(|i| *i as float);
10881088
tim_sort(arr); // !sort
10891089
isSorted(arr);
10901090
}

0 commit comments

Comments
 (0)