Rename some variables for consistency.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
Fixes #50.
This commit is contained in:
parent
23cf9e6ba4
commit
f355fad06b
|
@ -156,15 +156,18 @@ pub struct DicePoolRoll {
|
||||||
rolls: Vec<i32>,
|
rolls: Vec<i32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Amount of dice to display before cutting off and showing "and X
|
||||||
|
/// more", so we don't spam the room with huge messages.
|
||||||
|
const MAX_DISPLAYED_ROLLS: usize = 15;
|
||||||
|
|
||||||
fn fmt_rolls(pool: &DicePoolRoll) -> String {
|
fn fmt_rolls(pool: &DicePoolRoll) -> String {
|
||||||
let max_displayed_rolls = 15;
|
|
||||||
let rolls = pool.rolls();
|
let rolls = pool.rolls();
|
||||||
if rolls.len() > max_displayed_rolls {
|
if rolls.len() > MAX_DISPLAYED_ROLLS {
|
||||||
let first_ten = rolls.iter().take(max_displayed_rolls).join(", ");
|
let shown_amount = rolls.iter().take(MAX_DISPLAYED_ROLLS).join(", ");
|
||||||
format!(
|
format!(
|
||||||
"{}, and {} more",
|
"{}, and {} more",
|
||||||
first_ten,
|
shown_amount,
|
||||||
rolls.len() - max_displayed_rolls
|
rolls.len() - MAX_DISPLAYED_ROLLS
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
rolls.iter().join(", ")
|
rolls.iter().join(", ")
|
||||||
|
|
Loading…
Reference in New Issue