From f08c5370073284e74582d8611d6b6cff1506077a Mon Sep 17 00:00:00 2001 From: Martin Huschenbett Date: Wed, 6 Dec 2023 15:16:01 +0100 Subject: [PATCH] Use type annotation instead of turbo fish in method chapter (#1558) If we use a type annotation, we get around explaining the turbo fish, which isn't trivial without having introduced generics. Type annotations on the other hand are known already. --- src/methods-and-traits/methods.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/methods-and-traits/methods.md b/src/methods-and-traits/methods.md index b78b42ed..83691fe4 100644 --- a/src/methods-and-traits/methods.md +++ b/src/methods-and-traits/methods.md @@ -31,7 +31,7 @@ impl Race { } fn finish(self) { // Exclusive ownership of self - let total = self.laps.iter().sum::(); + let total: i32 = self.laps.iter().sum(); println!("Race {} is finished, total lap time: {}", self.name, total); } }