Fix Games methods to not take ownership of self

This commit is contained in:
Evie Litherland-Smith 2023-12-31 16:47:53 +00:00
parent 055ec379d7
commit 4d7036ade2

View file

@ -23,14 +23,14 @@ impl Games {
.collect(),
}
}
fn valid_games(self) -> Vec<i32> {
fn valid_games(&self) -> Vec<i32> {
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()
}
}