From 7880d950afb54128fb29c3e152ff62a61061277a Mon Sep 17 00:00:00 2001 From: projectmoon Date: Sat, 3 Oct 2020 20:56:00 +0000 Subject: [PATCH] Use unwrap_or instead of match to calculate oldest message age. --- src/config.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/config.rs b/src/config.rs index 14d6217..2c8dfda 100644 --- a/src/config.rs +++ b/src/config.rs @@ -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) } }