diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d3d31c7..be2aed48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # [unreleased] +# 0.16.1 + +Bug fixes: + +* Change `PartialEq` implementations to compare IDs with string literals from `str` to `&str` + * This is technically a breaking change, but the previous implementations were extremely + unlikely to actually be used + # 0.16.0 Breaking changes: diff --git a/Cargo.toml b/Cargo.toml index e9c35ce6..d19f2d69 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ license = "MIT" name = "ruma-identifiers" readme = "README.md" repository = "https://github.com/ruma/ruma-identifiers" -version = "0.16.0" +version = "0.16.1" edition = "2018" [package.metadata.docs.rs] diff --git a/src/macros.rs b/src/macros.rs index b823ff20..881f5292 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -83,15 +83,15 @@ macro_rules! common_impls { } } - impl ::std::cmp::PartialEq for $id { - fn eq(&self, other: &str) -> bool { - self.full_id == other + impl ::std::cmp::PartialEq<&str> for $id { + fn eq(&self, other: &&str) -> bool { + self.full_id == *other } } - impl ::std::cmp::PartialEq<$id> for str { + impl ::std::cmp::PartialEq<$id> for &str { fn eq(&self, other: &$id) -> bool { - self == other.full_id + *self == other.full_id } } diff --git a/src/room_version_id.rs b/src/room_version_id.rs index 603a5085..02cd7bf4 100644 --- a/src/room_version_id.rs +++ b/src/room_version_id.rs @@ -218,15 +218,15 @@ impl TryFrom for RoomVersionId { } } -impl PartialEq for RoomVersionId { - fn eq(&self, other: &str) -> bool { - self.as_ref() == other +impl PartialEq<&str> for RoomVersionId { + fn eq(&self, other: &&str) -> bool { + self.as_ref() == *other } } -impl PartialEq for str { +impl PartialEq for &str { fn eq(&self, other: &RoomVersionId) -> bool { - self == other.as_ref() + *self == other.as_ref() } }