From 85522ac35a7f0169a566923138b7c539fdd6747b Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Sat, 11 Jul 2020 21:14:32 +0200 Subject: [PATCH] Slightly simplify RoomName::calculate_name --- matrix_sdk_base/src/models/room.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/matrix_sdk_base/src/models/room.rs b/matrix_sdk_base/src/models/room.rs index 28a3f930..070bed11 100644 --- a/matrix_sdk_base/src/models/room.rs +++ b/matrix_sdk_base/src/models/room.rs @@ -250,15 +250,10 @@ impl RoomName { } else if !self.aliases.is_empty() && !self.aliases[0].alias().is_empty() { self.aliases[0].alias().trim().to_string() } else { - let joined = self.joined_member_count.unwrap_or(UInt::MIN); - let invited = self.invited_member_count.unwrap_or(UInt::MIN); + let joined = self.joined_member_count.unwrap_or(uint!(0)); + let invited = self.invited_member_count.unwrap_or(uint!(0)); let heroes = UInt::new(self.heroes.len() as u64).unwrap(); - - let invited_joined = if invited + joined == UInt::MIN { - UInt::MIN - } else { - invited + joined - uint!(1) - }; + let invited_joined = (invited + joined).saturating_sub(uint!(1)); let members = joined_members.values().chain(invited_members.values());