Skip to content

Commit 9ea84ae

Browse files
committed
Replace all uses of &foo[] with &foo[..] en masse.
1 parent 64cd30e commit 9ea84ae

File tree

145 files changed

+865
-864
lines changed

Some content is hidden

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

145 files changed

+865
-864
lines changed

src/compiletest/runtest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
688688
.unwrap()
689689
.to_string();
690690

691-
script_str.push_str(&format!("command script import {}\n", &rust_pp_module_abs_path[])[]);
691+
script_str.push_str(&format!("command script import {}\n", &rust_pp_module_abs_path[..])[]);
692692
script_str.push_str("type summary add --no-value ");
693693
script_str.push_str("--python-function lldb_rust_formatters.print_val ");
694694
script_str.push_str("-x \".*\" --category Rust\n");

src/doc/reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3587,7 +3587,7 @@ An example of each kind:
35873587
```{rust}
35883588
let vec: Vec<i32> = vec![1, 2, 3];
35893589
let arr: [i32; 3] = [1, 2, 3];
3590-
let s: &[i32] = &vec[];
3590+
let s: &[i32] = &vec[..];
35913591
```
35923592

35933593
As you can see, the `vec!` macro allows you to create a `Vec<T>` easily. The

src/doc/trpl/patterns.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ If you want to match against a slice or array, you can use `&`:
180180
fn main() {
181181
let v = vec!["match_this", "1"];
182182
183-
match &v[] {
183+
match &v[..] {
184184
["match_this", second] => println!("The second element is {}", second),
185185
_ => {},
186186
}

src/libcollections/slice.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,12 +1177,12 @@ impl ElementSwaps {
11771177

11781178
#[unstable(feature = "collections", reason = "trait is unstable")]
11791179
impl<T> BorrowFrom<Vec<T>> for [T] {
1180-
fn borrow_from(owned: &Vec<T>) -> &[T] { &owned[] }
1180+
fn borrow_from(owned: &Vec<T>) -> &[T] { &owned[..] }
11811181
}
11821182

11831183
#[unstable(feature = "collections", reason = "trait is unstable")]
11841184
impl<T> BorrowFromMut<Vec<T>> for [T] {
1185-
fn borrow_from_mut(owned: &mut Vec<T>) -> &mut [T] { &mut owned[] }
1185+
fn borrow_from_mut(owned: &mut Vec<T>) -> &mut [T] { &mut owned[..] }
11861186
}
11871187

11881188
#[unstable(feature = "collections", reason = "trait is unstable")]
@@ -1743,7 +1743,7 @@ mod tests {
17431743
#[test]
17441744
fn test_slice_from() {
17451745
let vec: &[_] = &[1, 2, 3, 4];
1746-
assert_eq!(&vec[], vec);
1746+
assert_eq!(&vec[..], vec);
17471747
let b: &[_] = &[3, 4];
17481748
assert_eq!(&vec[2..], b);
17491749
let b: &[_] = &[];
@@ -1996,9 +1996,9 @@ mod tests {
19961996

19971997
#[test]
19981998
fn test_lexicographic_permutations_empty_and_short() {
1999-
let empty : &mut[i32] = &mut[];
1999+
let empty : &mut[i32] = &mut[..];
20002000
assert!(empty.next_permutation() == false);
2001-
let b: &mut[i32] = &mut[];
2001+
let b: &mut[i32] = &mut[..];
20022002
assert!(empty == b);
20032003
assert!(empty.prev_permutation() == false);
20042004
assert!(empty == b);
@@ -2264,15 +2264,15 @@ mod tests {
22642264
#[test]
22652265
fn test_total_ord() {
22662266
let c = &[1, 2, 3];
2267-
[1, 2, 3, 4][].cmp(c) == Greater;
2267+
[1, 2, 3, 4][..].cmp(c) == Greater;
22682268
let c = &[1, 2, 3, 4];
2269-
[1, 2, 3][].cmp(c) == Less;
2269+
[1, 2, 3][..].cmp(c) == Less;
22702270
let c = &[1, 2, 3, 6];
2271-
[1, 2, 3, 4][].cmp(c) == Equal;
2271+
[1, 2, 3, 4][..].cmp(c) == Equal;
22722272
let c = &[1, 2, 3, 4, 5, 6];
2273-
[1, 2, 3, 4, 5, 5, 5, 5][].cmp(c) == Less;
2273+
[1, 2, 3, 4, 5, 5, 5, 5][..].cmp(c) == Less;
22742274
let c = &[1, 2, 3, 4];
2275-
[2, 2][].cmp(c) == Greater;
2275+
[2, 2][..].cmp(c) == Greater;
22762276
}
22772277

22782278
#[test]

0 commit comments

Comments
 (0)