Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-expand/src/name.rs')
| -rw-r--r-- | crates/hir-expand/src/name.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/crates/hir-expand/src/name.rs b/crates/hir-expand/src/name.rs index cc53d2e34a..9cfa3b4b32 100644 --- a/crates/hir-expand/src/name.rs +++ b/crates/hir-expand/src/name.rs @@ -51,12 +51,24 @@ impl PartialEq<Symbol> for Name { } } +impl PartialEq<&Symbol> for Name { + fn eq(&self, &sym: &&Symbol) -> bool { + self.symbol == *sym + } +} + impl PartialEq<Name> for Symbol { fn eq(&self, name: &Name) -> bool { *self == name.symbol } } +impl PartialEq<Name> for &Symbol { + fn eq(&self, name: &Name) -> bool { + **self == name.symbol + } +} + /// Wrapper of `Name` to print the name without "r#" even when it is a raw identifier. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub struct UnescapedName<'a>(&'a Name); |