Use unwrap_or instead of match to calculate oldest message age.

This commit is contained in:
projectmoon 2020-10-03 20:56:00 +00:00
parent 514ac84e73
commit 7880d950af
1 changed files with 4 additions and 4 deletions

View File

@ -26,11 +26,11 @@ impl BotConfig {
/// Determine the oldest allowable message age, in seconds. If the
/// setting is defined, use that value. If it is not defined, fall
/// back to DEFAULT_OLDEST_MESSAGE_AGE (15 minutes).
#[inline]
#[must_use]
fn oldest_message_age(&self) -> u64 {
match self.oldest_message_age {
Some(seconds) => seconds,
None => DEFAULT_OLDEST_MESSAGE_AGE,
}
self.oldest_message_age
.unwrap_or(DEFAULT_OLDEST_MESSAGE_AGE)
}
}