Skip to content

Commit c403794

Browse files
committed
Small fix in the book
Fixes rust-lang#20914
1 parent b21a6da commit c403794

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/doc/trpl/arrays-vectors-and-slices.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ arrays:
8282

8383
```{rust}
8484
let a = [0, 1, 2, 3, 4];
85-
let middle = a.slice(1, 4); // A slice of a: just the elements [1,2,3]
85+
let middle = &a[1..4]; // A slice of a: just the elements 1, 2, and 3
8686
8787
for e in middle.iter() {
8888
println!("{}", e); // Prints 1, 2, 3

0 commit comments

Comments
 (0)