diff --git a/Cargo.toml b/Cargo.toml index a284189a..308db8d5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,7 @@ url = "2.1.1" async-trait = "0.1.30" # Ruma dependencies -js_int = "0.1.4" +js_int = "0.1.5" ruma-api = "0.16.0-rc.2" ruma-client-api = { version = "0.8.0-rc.5" } ruma-events = { version = "0.21.0-beta.1" } diff --git a/src/models/room.rs b/src/models/room.rs index d2e19ef6..a7f04230 100644 --- a/src/models/room.rs +++ b/src/models/room.rs @@ -147,13 +147,13 @@ 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_value()); - let invited = self.invited_member_count.unwrap_or(UInt::min_value()); + let joined = self.joined_member_count.unwrap_or(UInt::MIN); + let invited = self.invited_member_count.unwrap_or(UInt::MIN); let heroes = UInt::new(self.heroes.len() as u64).unwrap(); let one = UInt::new(1).unwrap(); - let invited_joined = if invited + joined == UInt::min_value() { - UInt::min_value() + let invited_joined = if invited + joined == UInt::MIN { + UInt::MIN } else { invited + joined - one }; diff --git a/src/request_builder.rs b/src/request_builder.rs index f00ed1a3..bdfa9168 100644 --- a/src/request_builder.rs +++ b/src/request_builder.rs @@ -326,17 +326,15 @@ mod test { .invite_3pid(vec![]) .is_direct(true) .power_level_override(PowerLevelsEventContent { - ban: Int::max_value(), + ban: Int::MAX, events: BTreeMap::default(), - events_default: Int::min_value(), - invite: Int::min_value(), - kick: Int::min_value(), - redact: Int::max_value(), - state_default: Int::min_value(), - users_default: Int::min_value(), - notifications: NotificationPowerLevels { - room: Int::min_value(), - }, + events_default: Int::MIN, + invite: Int::MIN, + kick: Int::MIN, + redact: Int::MAX, + state_default: Int::MIN, + users_default: Int::MIN, + notifications: NotificationPowerLevels { room: Int::MIN }, users: BTreeMap::default(), }) .preset(RoomPreset::PrivateChat)