Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/compiletest/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
.unwrap()
.to_string();

script_str.push_str(&format!("command script import {}\n", &rust_pp_module_abs_path[])[]);
script_str.push_str(&format!("command script import {}\n", &rust_pp_module_abs_path[..])[]);
script_str.push_str("type summary add --no-value ");
script_str.push_str("--python-function lldb_rust_formatters.print_val ");
script_str.push_str("-x \".*\" --category Rust\n");
Expand Down
2 changes: 1 addition & 1 deletion src/doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -3587,7 +3587,7 @@ An example of each kind:
```{rust}
let vec: Vec<i32> = vec![1, 2, 3];
let arr: [i32; 3] = [1, 2, 3];
let s: &[i32] = &vec[];
let s: &[i32] = &vec[..];
```

As you can see, the `vec!` macro allows you to create a `Vec<T>` easily. The
Expand Down
2 changes: 1 addition & 1 deletion src/doc/trpl/patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ If you want to match against a slice or array, you can use `&`:
fn main() {
let v = vec!["match_this", "1"];
match &v[] {
match &v[..] {
["match_this", second] => println!("The second element is {}", second),
_ => {},
}
Expand Down
20 changes: 10 additions & 10 deletions src/libcollections/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1177,12 +1177,12 @@ impl ElementSwaps {

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

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

#[unstable(feature = "collections", reason = "trait is unstable")]
Expand Down Expand Up @@ -1743,7 +1743,7 @@ mod tests {
#[test]
fn test_slice_from() {
let vec: &[_] = &[1, 2, 3, 4];
assert_eq!(&vec[], vec);
assert_eq!(&vec[..], vec);
let b: &[_] = &[3, 4];
assert_eq!(&vec[2..], b);
let b: &[_] = &[];
Expand Down Expand Up @@ -1996,9 +1996,9 @@ mod tests {

#[test]
fn test_lexicographic_permutations_empty_and_short() {
let empty : &mut[i32] = &mut[];
let empty : &mut[i32] = &mut[..];
assert!(empty.next_permutation() == false);
let b: &mut[i32] = &mut[];
let b: &mut[i32] = &mut[..];
assert!(empty == b);
assert!(empty.prev_permutation() == false);
assert!(empty == b);
Expand Down Expand Up @@ -2264,15 +2264,15 @@ mod tests {
#[test]
fn test_total_ord() {
let c = &[1, 2, 3];
[1, 2, 3, 4][].cmp(c) == Greater;
[1, 2, 3, 4][..].cmp(c) == Greater;
let c = &[1, 2, 3, 4];
[1, 2, 3][].cmp(c) == Less;
[1, 2, 3][..].cmp(c) == Less;
let c = &[1, 2, 3, 6];
[1, 2, 3, 4][].cmp(c) == Equal;
[1, 2, 3, 4][..].cmp(c) == Equal;
let c = &[1, 2, 3, 4, 5, 6];
[1, 2, 3, 4, 5, 5, 5, 5][].cmp(c) == Less;
[1, 2, 3, 4, 5, 5, 5, 5][..].cmp(c) == Less;
let c = &[1, 2, 3, 4];
[2, 2][].cmp(c) == Greater;
[2, 2][..].cmp(c) == Greater;
}

#[test]
Expand Down
Loading