From 4d7036ade25855252d14ed5e16476d45dc1d9c12 Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Sun, 31 Dec 2023 16:47:53 +0000 Subject: [PATCH] Fix Games methods to not take ownership of self --- day2/src/part1.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/day2/src/part1.rs b/day2/src/part1.rs index e3427c6..1cf93bc 100644 --- a/day2/src/part1.rs +++ b/day2/src/part1.rs @@ -23,14 +23,14 @@ impl Games { .collect(), } } - fn valid_games(self) -> Vec { + fn valid_games(&self) -> Vec { self.games .iter() .filter(|m| m.valid()) .map(|m| m.id) .collect() } - fn valid_sum(self) -> i32 { + fn valid_sum(&self) -> i32 { self.valid_games().iter().sum() } }