Slightly simplify RoomName::calculate_name

This commit is contained in:
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

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