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

master
Damir Jelić 2020-07-14 10:56:06 +02:00
parent 18b444aac5
commit a38efc0f29
1 changed files with 2 additions and 2 deletions

View File

@ -250,8 +250,8 @@ impl RoomName {
} else if !self.aliases.is_empty() && !self.aliases[0].alias().is_empty() { } else if !self.aliases.is_empty() && !self.aliases[0].alias().is_empty() {
self.aliases[0].alias().trim().to_string() self.aliases[0].alias().trim().to_string()
} else { } else {
let joined = self.joined_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(uint!(0)); let invited = self.invited_member_count.unwrap_or_else(|| uint!(0));
let heroes = UInt::new(self.heroes.len() as u64).unwrap(); let heroes = UInt::new(self.heroes.len() as u64).unwrap();
let invited_joined = (invited + joined).saturating_sub(uint!(1)); let invited_joined = (invited + joined).saturating_sub(uint!(1));