Skip to content

Commit

Permalink
Improved code clarity.
Browse files Browse the repository at this point in the history
  • Loading branch information
andymandias committed Feb 27, 2024
1 parent 2ebb636 commit ff57943
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions data/src/history/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -552,16 +552,16 @@ fn smart_filter_message(
seconds: &i64,
most_recent_message_server_time: Option<&DateTime<Utc>>,
) -> 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)]
Expand Down

0 comments on commit ff57943

Please sign in to comment.