From ff579435648f303dedbe83b637390c57d8c4a4de Mon Sep 17 00:00:00 2001 From: Andrew Baldwin Date: Sun, 25 Feb 2024 13:29:52 -0800 Subject: [PATCH] Improved code clarity. --- data/src/history/manager.rs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/data/src/history/manager.rs b/data/src/history/manager.rs index 67d9b1125..e7925034e 100644 --- a/data/src/history/manager.rs +++ b/data/src/history/manager.rs @@ -451,9 +451,9 @@ impl Data { Exclude::None => true, Exclude::Smart(seconds) => { let nick = match source { - message::source::Server::Join(nick) => nick, - message::source::Server::Part(nick) => nick, - message::source::Server::Quit(nick) => nick, + message::source::Server::Join(nick) => nick, + message::source::Server::Part(nick) => nick, + message::source::Server::Quit(nick) => nick, }; if nick.is_some() { @@ -552,16 +552,16 @@ fn smart_filter_message( seconds: &i64, most_recent_message_server_time: Option<&DateTime>, ) -> bool { - if most_recent_message_server_time.is_some() { - let duration_seconds = message - .server_time - .signed_duration_since(*most_recent_message_server_time.unwrap()) - .num_seconds(); - - duration_seconds > *seconds - } else { - true - } + let Some(server_time) = most_recent_message_server_time else { + return true; + }; + + let duration_seconds = message + .server_time + .signed_duration_since(*server_time) + .num_seconds(); + + duration_seconds > *seconds } #[derive(Debug, Clone)]