Skip to content

Commit a33ad2a

Browse files
committed
Merge pull request #21013 from steveklabnik/gh20914
Small fix in the book Reviewed-by: alexcrichton
2 parents ea28015 + c403794 commit a33ad2a

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)