Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c1d48a8

Browse files
author
Jorge Aparicio
committedJan 12, 2015
cleanup: &foo[0..a] -> &foo[..a]
1 parent 3a44a19 commit c1d48a8

File tree

44 files changed

+104
-105
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+104
-105
lines changed
 

‎src/libcollections/slice.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1631,7 +1631,7 @@ mod tests {
16311631
#[test]
16321632
fn test_slice_from() {
16331633
let vec: &[int] = &[1, 2, 3, 4];
1634-
assert_eq!(&vec[0..], vec);
1634+
assert_eq!(&vec[], vec);
16351635
let b: &[int] = &[3, 4];
16361636
assert_eq!(&vec[2..], b);
16371637
let b: &[int] = &[];
@@ -1641,11 +1641,11 @@ mod tests {
16411641
#[test]
16421642
fn test_slice_to() {
16431643
let vec: &[int] = &[1, 2, 3, 4];
1644-
assert_eq!(&vec[0..4], vec);
1644+
assert_eq!(&vec[..4], vec);
16451645
let b: &[int] = &[1, 2];
1646-
assert_eq!(&vec[0..2], b);
1646+
assert_eq!(&vec[..2], b);
16471647
let b: &[int] = &[];
1648-
assert_eq!(&vec[0..0], b);
1648+
assert_eq!(&vec[..0], b);
16491649
}
16501650

16511651

@@ -2538,15 +2538,15 @@ mod tests {
25382538
let (left, right) = values.split_at_mut(2);
25392539
{
25402540
let left: &[_] = left;
2541-
assert!(left[0..left.len()] == [1, 2][]);
2541+
assert!(left[..left.len()] == [1, 2][]);
25422542
}
25432543
for p in left.iter_mut() {
25442544
*p += 1;
25452545
}
25462546

25472547
{
25482548
let right: &[_] = right;
2549-
assert!(right[0..right.len()] == [3, 4, 5][]);
2549+
assert!(right[..right.len()] == [3, 4, 5][]);
25502550
}
25512551
for p in right.iter_mut() {
25522552
*p += 2;

‎src/libcollections/str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ pub trait StrExt: Index<FullRange, Output = str> {
807807
/// out of bounds.
808808
///
809809
/// See also `slice`, `slice_from` and `slice_chars`.
810-
#[unstable = "use slice notation [0..a] instead"]
810+
#[unstable = "use slice notation [..a] instead"]
811811
fn slice_to(&self, end: uint) -> &str {
812812
core_str::StrExt::slice_to(&self[], end)
813813
}

0 commit comments

Comments
 (0)