Remove RoomVersionId::custom constructor

It could be used to create invalid room versions like an empty one or
one with more than 32 code points.
This commit is contained in:
Jonas Platte 2020-06-23 12:40:01 +02:00
parent 99999af08d
commit c5db6d56ad
No known key found for this signature in database
GPG Key ID: 7D261D771D915378
2 changed files with 4 additions and 10 deletions

View File

@ -2,7 +2,10 @@
Breaking changes:
* Removed diesel integration. If you were using it, please comment on the corresponding issue:
* Remove `RoomVersionId::custom`. It could be used to create invalid room versions (empty or
exceeding 32 code points in length). Use the `TryFrom<&str>` or `TryFrom<String>` implementation
instead.
* Remove diesel integration. If you were using it, please comment on the corresponding issue:
https://github.com/ruma/ruma-identifiers/issues/22
* Remove `TryFrom<Cow<'_, str>>` implementations for identifier types
* Update `parse_with_server_name`s signature (instead of `Into<String>` it now requires

View File

@ -87,14 +87,6 @@ impl<T> RoomVersionId<T> {
Self(InnerRoomVersionId::Version6)
}
/// Creates a custom room version ID from the given string slice.
pub fn custom(id: String) -> Self
where
String: Into<T>,
{
Self(InnerRoomVersionId::Custom(id.into()))
}
/// Whether or not this room version is an official one specified by the Matrix protocol.
pub fn is_official(&self) -> bool {
!self.is_custom()
@ -408,7 +400,6 @@ mod tests {
assert!(RoomVersionId::version_3().is_version_3());
assert!(RoomVersionId::version_4().is_version_4());
assert!(RoomVersionId::version_5().is_version_5());
assert!(RoomVersionId::custom("foo".into()).is_custom());
}
#[test]