From eedc18924deb0108896c9baaa2d6e34bdda69030 Mon Sep 17 00:00:00 2001 From: JirCep Date: Mon, 2 May 2022 17:59:39 +0200 Subject: [PATCH] Extra-clarity qualification MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Regard the preceding wording “we’ve annotated the types of the values that are returned from these functions for extra clarity.” while only the indexing function is annotated. --- listings/ch08-common-collections/listing-08-05/src/main.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/listings/ch08-common-collections/listing-08-05/src/main.rs b/listings/ch08-common-collections/listing-08-05/src/main.rs index 9bfa37a4c..a09abd9b0 100644 --- a/listings/ch08-common-collections/listing-08-05/src/main.rs +++ b/listings/ch08-common-collections/listing-08-05/src/main.rs @@ -5,7 +5,8 @@ fn main() { let third: &i32 = &v[2]; println!("The third element is {}", third); - match v.get(2) { + let third: Option<&i32> = v.get(2); + match third { Some(third) => println!("The third element is {}", third), None => println!("There is no third element."), }