Avoid cloning when counting successes.
continuous-integration/drone/push Build is passing Details

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 {
let successes = self
let successes: usize = self
.rolls
.iter()
.cloned()
.filter(|&roll| roll >= self.modifiers.success_on)
.filter(|&roll| *roll >= self.modifiers.success_on)
.count();
i32::try_from(successes).unwrap_or(0)
}