cleanup: &foo[0..a] -> &foo[..a]

This commit is contained in:
Jorge Aparicio 2015-01-12 16:59:18 -05:00
parent 3a44a19af2
commit c1d48a8508
44 changed files with 104 additions and 105 deletions

View file

@ -128,7 +128,7 @@ impl<'a, W: Writer> RepeatFasta<'a, W> {
copy_memory(buf.as_mut_slice(), alu);
let buf_len = buf.len();
copy_memory(buf.slice_mut(alu_len, buf_len),
&alu[0..LINE_LEN]);
&alu[..LINE_LEN]);
let mut pos = 0;
let mut bytes;
@ -204,7 +204,7 @@ impl<'a, W: Writer> RandomFasta<'a, W> {
for i in range(0u, chars_left) {
buf[i] = self.nextc();
}
self.out.write(&buf[0..chars_left])
self.out.write(&buf[..chars_left])
}
}

View file

@ -13,7 +13,7 @@ fn main() {
let ss: &&[int] = &s;
let sss: &&&[int] = &ss;
println!("{:?}", &s[0..3]);
println!("{:?}", &s[..3]);
println!("{:?}", &ss[3..]);
println!("{:?}", &sss[2..4]);
}

View file

@ -16,7 +16,7 @@ pub fn main() {
let abc = [1i, 2, 3];
let tf = [true, false];
let x = [(), ()];
let slice = &x[0..1];
let slice = &x[..1];
assert_repr_eq(&abc[], "[1i, 2i, 3i]".to_string());
assert_repr_eq(&tf[], "[true, false]".to_string());

View file

@ -17,7 +17,7 @@ fn main() {
let cmp: &[int] = &[3, 4, 5];
assert!(&x[2..] == cmp);
let cmp: &[int] = &[1, 2, 3];
assert!(&x[0..3] == cmp);
assert!(&x[..3] == cmp);
let cmp: &[int] = &[2, 3, 4];
assert!(&x[1..4] == cmp);
@ -27,7 +27,7 @@ fn main() {
let cmp: &[int] = &[3, 4, 5];
assert!(&x[2..] == cmp);
let cmp: &[int] = &[1, 2, 3];
assert!(&x[0..3] == cmp);
assert!(&x[..3] == cmp);
let cmp: &[int] = &[2, 3, 4];
assert!(&x[1..4] == cmp);