about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorNick Cameron <ncameron@mozilla.com>2014-09-24 23:41:09 +1200
committerNick Cameron <ncameron@mozilla.com>2014-10-07 15:49:53 +1300
commit59976942eacd26c0cc37247c3ac0c78b97edc6ea (patch)
tree81df79265eb8601f2965303b9626b80ee728208f /src/test
parentb5ba2f5517b1f90d07969ca3facdf5132e42436c (diff)
downloadrust-59976942eacd26c0cc37247c3ac0c78b97edc6ea.tar.gz
rust-59976942eacd26c0cc37247c3ac0c78b97edc6ea.zip
Use slice syntax instead of slice_to, etc.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/bench/shootout-fannkuch-redux.rs6
-rw-r--r--src/test/bench/shootout-fasta-redux.rs6
-rw-r--r--src/test/bench/shootout-fasta.rs2
-rw-r--r--src/test/bench/shootout-k-nucleotide-pipes.rs4
-rw-r--r--src/test/bench/shootout-k-nucleotide.rs4
-rw-r--r--src/test/bench/shootout-reverse-complement.rs2
-rw-r--r--src/test/compile-fail/issue-15730.rs2
-rw-r--r--src/test/debuginfo/vec-slices.rs2
-rw-r--r--src/test/run-pass/issue-3888-2.rs2
-rw-r--r--src/test/run-pass/issue-4464.rs2
-rw-r--r--src/test/run-pass/issue-8898.rs2
11 files changed, 17 insertions, 17 deletions
diff --git a/src/test/bench/shootout-fannkuch-redux.rs b/src/test/bench/shootout-fannkuch-redux.rs
index 5e812e500d6..1260cc33725 100644
--- a/src/test/bench/shootout-fannkuch-redux.rs
+++ b/src/test/bench/shootout-fannkuch-redux.rs
@@ -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.slice_to_mut(i + 1));
+        rotate(perm[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.slice_to(i + 1).iter()) {
+            for (place, val) in pp.iter_mut().zip(self.perm.p[..i+1].iter()) {
                 *place = (*val) as u8
             }
 
@@ -125,7 +125,7 @@ impl Perm {
 
 
 fn reverse(tperm: &mut [i32], mut k: uint) {
-    tperm.slice_to_mut(k).reverse()
+    tperm[mut ..k].reverse()
 }
 
 fn work(mut perm: Perm, n: uint, max: uint) -> (i32, i32) {
diff --git a/src/test/bench/shootout-fasta-redux.rs b/src/test/bench/shootout-fasta-redux.rs
index b68404bdd72..3f8c929aecf 100644
--- a/src/test/bench/shootout-fasta-redux.rs
+++ b/src/test/bench/shootout-fasta-redux.rs
@@ -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.slice_mut(alu_len, buf_len),
-                    alu.slice_to(LINE_LEN));
+        copy_memory(buf[mut alu_len..buf_len],
+                    alu[..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.slice_to(chars_left))
+        self.out.write(buf[..chars_left])
     }
 }
 
diff --git a/src/test/bench/shootout-fasta.rs b/src/test/bench/shootout-fasta.rs
index e5ddcac1e8f..ed8ddcaa0ed 100644
--- a/src/test/bench/shootout-fasta.rs
+++ b/src/test/bench/shootout-fasta.rs
@@ -93,7 +93,7 @@ fn make_fasta<W: Writer, I: Iterator<u8>>(
         }
         n -= nb;
         line[nb] = '\n' as u8;
-        wr.write(line.slice_to(nb + 1));
+        wr.write(line[..nb+1]);
     }
 }
 
diff --git a/src/test/bench/shootout-k-nucleotide-pipes.rs b/src/test/bench/shootout-k-nucleotide-pipes.rs
index f4d1cee5fb4..80d623bbeb1 100644
--- a/src/test/bench/shootout-k-nucleotide-pipes.rs
+++ b/src/test/bench/shootout-k-nucleotide-pipes.rs
@@ -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.slice(ii, ii+nn));
+      it(bb[ii..ii+nn]);
       ii += 1u;
    }
 
-   return Vec::from_slice(bb.slice(len - (nn - 1u), len));
+   return Vec::from_slice(bb[len - (nn - 1u)..len]);
 }
 
 fn make_sequence_processor(sz: uint,
diff --git a/src/test/bench/shootout-k-nucleotide.rs b/src/test/bench/shootout-k-nucleotide.rs
index cecc95354af..70fd937d2a3 100644
--- a/src/test/bench/shootout-k-nucleotide.rs
+++ b/src/test/bench/shootout-k-nucleotide.rs
@@ -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.slice_from(1);
+        input = input[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.slice_from(1);
+        input = input[1..];
     }
     frequencies
 }
diff --git a/src/test/bench/shootout-reverse-complement.rs b/src/test/bench/shootout-reverse-complement.rs
index e522bcaf4db..e5f22a3d07c 100644
--- a/src/test/bench/shootout-reverse-complement.rs
+++ b/src/test/bench/shootout-reverse-complement.rs
@@ -81,7 +81,7 @@ fn main() {
             Some(c) => c
         };
         let len = seq.len();
-        let seq = seq.slice_mut(begin + 1, len - 1);
+        let seq = seq[mut begin+1..len-1];
 
         // arrange line breaks
         let len = seq.len();
diff --git a/src/test/compile-fail/issue-15730.rs b/src/test/compile-fail/issue-15730.rs
index 6cddd8ee939..fc8c4e36075 100644
--- a/src/test/compile-fail/issue-15730.rs
+++ b/src/test/compile-fail/issue-15730.rs
@@ -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.slice(1, 2);
+    let pie_slice = array[1..2];
 }
diff --git a/src/test/debuginfo/vec-slices.rs b/src/test/debuginfo/vec-slices.rs
index ba8c4d249ce..392a025b1f0 100644
--- a/src/test/debuginfo/vec-slices.rs
+++ b/src/test/debuginfo/vec-slices.rs
@@ -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.slice(1,3);
+    let slice_of_slice = multiple[1..3];
 
     let padded_tuple: &[(i32, i16)] = &[(6, 7), (8, 9)];
 
diff --git a/src/test/run-pass/issue-3888-2.rs b/src/test/run-pass/issue-3888-2.rs
index c9f6733fa25..20629673619 100644
--- a/src/test/run-pass/issue-3888-2.rs
+++ b/src/test/run-pass/issue-3888-2.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 fn vec_peek<'r, T>(v: &'r [T]) -> &'r [T] {
-    v.slice(1, 5)
+    v[1..5]
 }
 
 pub fn main() {}
diff --git a/src/test/run-pass/issue-4464.rs b/src/test/run-pass/issue-4464.rs
index 822fda8a18e..0f3f9149536 100644
--- a/src/test/run-pass/issue-4464.rs
+++ b/src/test/run-pass/issue-4464.rs
@@ -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.slice(i, j) }
+fn broken(v: &[u8], i: uint, j: uint) -> &[u8] { v[i..j] }
 
 pub fn main() {}
diff --git a/src/test/run-pass/issue-8898.rs b/src/test/run-pass/issue-8898.rs
index d8ced58155d..5348476fad7 100644
--- a/src/test/run-pass/issue-8898.rs
+++ b/src/test/run-pass/issue-8898.rs
@@ -19,7 +19,7 @@ pub fn main() {
     let abc = [1i, 2, 3];
     let tf = [true, false];
     let x  = [(), ()];
-    let slice = x.slice(0, 1);
+    let slice = x[0..1];
 
     assert_repr_eq(abc, "[1, 2, 3]".to_string());
     assert_repr_eq(tf, "[true, false]".to_string());