about summary refs log tree commit diff
path: root/src/libcollections
diff options
context:
space:
mode:
authorJorge Aparicio <japaricious@gmail.com>2015-01-12 16:59:18 -0500
committerJorge Aparicio <japaricious@gmail.com>2015-01-12 17:59:37 -0500
commitc1d48a85082cfe3683ad9eda5223d3259d4fa718 (patch)
treeac65328b877bd7a2127dbd4d0edaf7b637f0878e /src/libcollections
parent3a44a19af29585c02e81e22ea7665f829ae0590a (diff)
downloadrust-c1d48a85082cfe3683ad9eda5223d3259d4fa718.tar.gz
rust-c1d48a85082cfe3683ad9eda5223d3259d4fa718.zip
cleanup: `&foo[0..a]` -> `&foo[..a]`
Diffstat (limited to 'src/libcollections')
-rw-r--r--src/libcollections/slice.rs12
-rw-r--r--src/libcollections/str.rs2
-rw-r--r--src/libcollections/string.rs2
3 files changed, 8 insertions, 8 deletions
diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs
index 9a1f22ef7a6..4812ecc2c0b 100644
--- a/src/libcollections/slice.rs
+++ b/src/libcollections/slice.rs
@@ -1631,7 +1631,7 @@ mod tests {
     #[test]
     fn test_slice_from() {
         let vec: &[int] = &[1, 2, 3, 4];
-        assert_eq!(&vec[0..], vec);
+        assert_eq!(&vec[], vec);
         let b: &[int] = &[3, 4];
         assert_eq!(&vec[2..], b);
         let b: &[int] = &[];
@@ -1641,11 +1641,11 @@ mod tests {
     #[test]
     fn test_slice_to() {
         let vec: &[int] = &[1, 2, 3, 4];
-        assert_eq!(&vec[0..4], vec);
+        assert_eq!(&vec[..4], vec);
         let b: &[int] = &[1, 2];
-        assert_eq!(&vec[0..2], b);
+        assert_eq!(&vec[..2], b);
         let b: &[int] = &[];
-        assert_eq!(&vec[0..0], b);
+        assert_eq!(&vec[..0], b);
     }
 
 
@@ -2538,7 +2538,7 @@ mod tests {
             let (left, right) = values.split_at_mut(2);
             {
                 let left: &[_] = left;
-                assert!(left[0..left.len()] == [1, 2][]);
+                assert!(left[..left.len()] == [1, 2][]);
             }
             for p in left.iter_mut() {
                 *p += 1;
@@ -2546,7 +2546,7 @@ mod tests {
 
             {
                 let right: &[_] = right;
-                assert!(right[0..right.len()] == [3, 4, 5][]);
+                assert!(right[..right.len()] == [3, 4, 5][]);
             }
             for p in right.iter_mut() {
                 *p += 2;
diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs
index ccf654ac0a0..96c73981e36 100644
--- a/src/libcollections/str.rs
+++ b/src/libcollections/str.rs
@@ -807,7 +807,7 @@ pub trait StrExt: Index<FullRange, Output = str> {
     /// out of bounds.
     ///
     /// See also `slice`, `slice_from` and `slice_chars`.
-    #[unstable = "use slice notation [0..a] instead"]
+    #[unstable = "use slice notation [..a] instead"]
     fn slice_to(&self, end: uint) -> &str {
         core_str::StrExt::slice_to(&self[], end)
     }
diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs
index e30e7e8600d..c845d86ca0f 100644
--- a/src/libcollections/string.rs
+++ b/src/libcollections/string.rs
@@ -168,7 +168,7 @@ impl String {
 
         if i > 0 {
             unsafe {
-                res.as_mut_vec().push_all(&v[0..i])
+                res.as_mut_vec().push_all(&v[..i])
             };
         }