Avoid cloning when counting successes.

This commit is contained in:
projectmoon 2020-12-17 21:20:45 +00:00
parent c9c80b974c
commit 297a8454f6
1 changed files with 3 additions and 3 deletions

View File

@ -190,12 +190,12 @@ impl DicePoolRoll {
} }
pub fn successes(&self) -> i32 { pub fn successes(&self) -> i32 {
let successes = self let successes: usize = self
.rolls .rolls
.iter() .iter()
.cloned() .filter(|&roll| *roll >= self.modifiers.success_on)
.filter(|&roll| roll >= self.modifiers.success_on)
.count(); .count();
i32::try_from(successes).unwrap_or(0) i32::try_from(successes).unwrap_or(0)
} }