Revert "Use slice syntax instead of slice_to, etc."
This reverts commit 40b9f5ded5.
This commit is contained in:
parent
c0c6c89589
commit
d2ea0315e0
81 changed files with 363 additions and 331 deletions
|
|
@ -50,7 +50,7 @@ fn rotate(x: &mut [i32]) {
|
|||
|
||||
fn next_permutation(perm: &mut [i32], count: &mut [i32]) {
|
||||
for i in range(1, perm.len()) {
|
||||
rotate(perm[mut ..i + 1]);
|
||||
rotate(perm.slice_to_mut(i + 1));
|
||||
let count_i = &mut count[i];
|
||||
if *count_i >= i as i32 {
|
||||
*count_i = 0;
|
||||
|
|
@ -99,7 +99,7 @@ impl Perm {
|
|||
let d = idx / self.fact[i] as i32;
|
||||
self.cnt[i] = d;
|
||||
idx %= self.fact[i] as i32;
|
||||
for (place, val) in pp.iter_mut().zip(self.perm.p[..i+1].iter()) {
|
||||
for (place, val) in pp.iter_mut().zip(self.perm.p.slice_to(i + 1).iter()) {
|
||||
*place = (*val) as u8
|
||||
}
|
||||
|
||||
|
|
@ -125,7 +125,7 @@ impl Perm {
|
|||
|
||||
|
||||
fn reverse(tperm: &mut [i32], mut k: uint) {
|
||||
tperm[mut ..k].reverse()
|
||||
tperm.slice_to_mut(k).reverse()
|
||||
}
|
||||
|
||||
fn work(mut perm: Perm, n: uint, max: uint) -> (i32, i32) {
|
||||
|
|
|
|||
|
|
@ -124,8 +124,8 @@ impl<'a, W: Writer> RepeatFasta<'a, W> {
|
|||
|
||||
copy_memory(buf.as_mut_slice(), alu);
|
||||
let buf_len = buf.len();
|
||||
copy_memory(buf[mut alu_len..buf_len],
|
||||
alu[..LINE_LEN]);
|
||||
copy_memory(buf.slice_mut(alu_len, buf_len),
|
||||
alu.slice_to(LINE_LEN));
|
||||
|
||||
let mut pos = 0;
|
||||
let mut bytes;
|
||||
|
|
@ -201,7 +201,7 @@ impl<'a, W: Writer> RandomFasta<'a, W> {
|
|||
for i in range(0u, chars_left) {
|
||||
buf[i] = self.nextc();
|
||||
}
|
||||
self.out.write(buf[..chars_left])
|
||||
self.out.write(buf.slice_to(chars_left))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ fn make_fasta<W: Writer, I: Iterator<u8>>(
|
|||
}
|
||||
n -= nb;
|
||||
line[nb] = '\n' as u8;
|
||||
wr.write(line[..nb+1]);
|
||||
wr.write(line.slice_to(nb + 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -97,11 +97,11 @@ fn windows_with_carry(bb: &[u8], nn: uint, it: |window: &[u8]|) -> Vec<u8> {
|
|||
|
||||
let len = bb.len();
|
||||
while ii < len - (nn - 1u) {
|
||||
it(bb[ii..ii+nn]);
|
||||
it(bb.slice(ii, ii+nn));
|
||||
ii += 1u;
|
||||
}
|
||||
|
||||
return Vec::from_slice(bb[len - (nn - 1u)..len]);
|
||||
return Vec::from_slice(bb.slice(len - (nn - 1u), len));
|
||||
}
|
||||
|
||||
fn make_sequence_processor(sz: uint,
|
||||
|
|
|
|||
|
|
@ -240,14 +240,14 @@ fn generate_frequencies(mut input: &[u8], frame: uint) -> Table {
|
|||
// Pull first frame.
|
||||
for _ in range(0, frame) {
|
||||
code = code.push_char(input[0]);
|
||||
input = input[1..];
|
||||
input = input.slice_from(1);
|
||||
}
|
||||
frequencies.lookup(code, BumpCallback);
|
||||
|
||||
while input.len() != 0 && input[0] != ('>' as u8) {
|
||||
code = code.rotate(input[0], frame);
|
||||
frequencies.lookup(code, BumpCallback);
|
||||
input = input[1..];
|
||||
input = input.slice_from(1);
|
||||
}
|
||||
frequencies
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ fn main() {
|
|||
Some(c) => c
|
||||
};
|
||||
let len = seq.len();
|
||||
let seq = seq[mut begin+1..len-1];
|
||||
let seq = seq.slice_mut(begin + 1, len - 1);
|
||||
|
||||
// arrange line breaks
|
||||
let len = seq.len();
|
||||
|
|
|
|||
|
|
@ -11,5 +11,5 @@
|
|||
fn main() {
|
||||
let mut array = [1, 2, 3];
|
||||
//~^ ERROR cannot determine a type for this local variable: cannot determine the type of this integ
|
||||
let pie_slice = array[1..2];
|
||||
let pie_slice = array.slice(1, 2);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ fn main() {
|
|||
let empty: &[i64] = &[];
|
||||
let singleton: &[i64] = &[1];
|
||||
let multiple: &[i64] = &[2, 3, 4, 5];
|
||||
let slice_of_slice = multiple[1..3];
|
||||
let slice_of_slice = multiple.slice(1,3);
|
||||
|
||||
let padded_tuple: &[(i32, i16)] = &[(6, 7), (8, 9)];
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
fn vec_peek<'r, T>(v: &'r [T]) -> &'r [T] {
|
||||
v[1..5]
|
||||
v.slice(1, 5)
|
||||
}
|
||||
|
||||
pub fn main() {}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,6 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn broken(v: &[u8], i: uint, j: uint) -> &[u8] { v[i..j] }
|
||||
fn broken(v: &[u8], i: uint, j: uint) -> &[u8] { v.slice(i, j) }
|
||||
|
||||
pub fn main() {}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ pub fn main() {
|
|||
let abc = [1i, 2, 3];
|
||||
let tf = [true, false];
|
||||
let x = [(), ()];
|
||||
let slice = x[0..1];
|
||||
let slice = x.slice(0,1);
|
||||
let z = box(GC) x;
|
||||
|
||||
assert_repr_eq(abc, "[1, 2, 3]".to_string());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue