Avoid cloning when counting successes.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
c9c80b974c
commit
297a8454f6
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue