Make string comparison PartialEq impls work
This commit is contained in:
parent
a67ba7a729
commit
89f0594a68
@ -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:
|
||||
|
@ -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]
|
||||
|
@ -83,15 +83,15 @@ macro_rules! common_impls {
|
||||
}
|
||||
}
|
||||
|
||||
impl ::std::cmp::PartialEq<str> 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
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -218,15 +218,15 @@ impl TryFrom<String> for RoomVersionId {
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq<str> 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<RoomVersionId> for str {
|
||||
impl PartialEq<RoomVersionId> for &str {
|
||||
fn eq(&self, other: &RoomVersionId) -> bool {
|
||||
self == other.as_ref()
|
||||
*self == other.as_ref()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user