room: Fix a clippy warning, use unwrap_or_else for the member counts.

This commit is contained in:
Damir Jelić 2020-07-14 10:56:06 +02:00
parent 18b444aac5
commit a38efc0f29

View file

@ -250,8 +250,8 @@ 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!(0));
let invited = self.invited_member_count.unwrap_or(uint!(0));
let joined = self.joined_member_count.unwrap_or_else(|| uint!(0));
let invited = self.invited_member_count.unwrap_or_else(|| uint!(0));
let heroes = UInt::new(self.heroes.len() as u64).unwrap();
let invited_joined = (invited + joined).saturating_sub(uint!(1));