Slightly simplify RoomName::calculate_name

master
Jonas Platte 2020-07-11 21:14:32 +02:00
parent 9b5f95672b
commit 85522ac35a
No known key found for this signature in database
GPG Key ID: 7D261D771D915378
1 changed files with 3 additions and 8 deletions

View File

@ -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());