Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-expand/src/ast_id_map.rs')
| -rw-r--r-- | crates/hir-expand/src/ast_id_map.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/crates/hir-expand/src/ast_id_map.rs b/crates/hir-expand/src/ast_id_map.rs index d0d229e131..7bdd6db932 100644 --- a/crates/hir-expand/src/ast_id_map.rs +++ b/crates/hir-expand/src/ast_id_map.rs @@ -191,7 +191,7 @@ impl AstIdMap { /// The [`AstId`] of the root node pub fn root(&self) -> SyntaxNodePtr { - self.arena[Idx::from_raw(RawIdx::from_u32(0))].clone() + self.arena[Idx::from_raw(RawIdx::from_u32(0))] } pub fn ast_id<N: AstIdNode>(&self, item: &N) -> FileAstId<N> { @@ -213,11 +213,11 @@ impl AstIdMap { } pub fn get<N: AstIdNode>(&self, id: FileAstId<N>) -> AstPtr<N> { - AstPtr::try_from_raw(self.arena[id.raw].clone()).unwrap() + AstPtr::try_from_raw(self.arena[id.raw]).unwrap() } pub fn get_erased(&self, id: ErasedFileAstId) -> SyntaxNodePtr { - self.arena[id].clone() + self.arena[id] } fn erased_ast_id(&self, item: &SyntaxNode) -> ErasedFileAstId { @@ -239,9 +239,7 @@ impl AstIdMap { } fn hash_ptr(ptr: &SyntaxNodePtr) -> u64 { - let mut hasher = BuildHasherDefault::<FxHasher>::default().build_hasher(); - ptr.hash(&mut hasher); - hasher.finish() + BuildHasherDefault::<FxHasher>::default().hash_one(ptr) } #[derive(Copy, Clone, PartialEq, Eq)] |