From d85643d5ac06e81c8c6cefbad8ec9a6bc64eedce Mon Sep 17 00:00:00 2001 From: Robin Stringer Date: Thu, 12 Jan 2023 16:11:46 +0000 Subject: [PATCH] Update src/basic-syntax/slices.md Co-authored-by: Martin Geisler --- src/basic-syntax/slices.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/basic-syntax/slices.md b/src/basic-syntax/slices.md index ebeb4443..f47ed959 100644 --- a/src/basic-syntax/slices.md +++ b/src/basic-syntax/slices.md @@ -21,7 +21,7 @@ fn main() { * If the slice starts at index 0, Rust’s range syntax means we can drop the starting index. -* The same is true for the last index, so `let s: &[i32] = &a[2..len];` or `let s: &[i32] = &a[2..];` are equal. +* The same is true for the last index, so `&a[2..a.len()]` and `&a[2..]` are equal. * We set `s` as a reference of `i32`s. Notice that the type of `s` no longer has an array length. This avoids type errors when performing computations on slices of different sizes.