diff options
author | Aleksey Kladov <[email protected]> | 2020-03-19 15:00:11 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-03-19 17:46:30 +0000 |
commit | f840fcb2f525c13809d6a736e434155edf075a06 (patch) | |
tree | ce3eb047dd9fe9005750a3b1417d95b1aa8fe01e /crates/ra_hir_expand/src | |
parent | 988f1dda6bde576ec2457dd97a7525014609c771 (diff) |
Simplify Arena to use a generic index
Diffstat (limited to 'crates/ra_hir_expand/src')
-rw-r--r-- | crates/ra_hir_expand/src/ast_id_map.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/crates/ra_hir_expand/src/ast_id_map.rs b/crates/ra_hir_expand/src/ast_id_map.rs index a764bdf24..a6644d55f 100644 --- a/crates/ra_hir_expand/src/ast_id_map.rs +++ b/crates/ra_hir_expand/src/ast_id_map.rs | |||
@@ -10,7 +10,7 @@ use std::{ | |||
10 | marker::PhantomData, | 10 | marker::PhantomData, |
11 | }; | 11 | }; |
12 | 12 | ||
13 | use ra_arena::{impl_arena_id, Arena, RawId}; | 13 | use ra_arena::{Arena, Idx}; |
14 | use ra_syntax::{ast, AstNode, AstPtr, SyntaxNode, SyntaxNodePtr}; | 14 | use ra_syntax::{ast, AstNode, AstPtr, SyntaxNode, SyntaxNodePtr}; |
15 | 15 | ||
16 | /// `AstId` points to an AST node in a specific file. | 16 | /// `AstId` points to an AST node in a specific file. |
@@ -49,14 +49,12 @@ impl<N: AstNode> FileAstId<N> { | |||
49 | } | 49 | } |
50 | } | 50 | } |
51 | 51 | ||
52 | #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] | 52 | type ErasedFileAstId = Idx<SyntaxNodePtr>; |
53 | struct ErasedFileAstId(RawId); | ||
54 | impl_arena_id!(ErasedFileAstId); | ||
55 | 53 | ||
56 | /// Maps items' `SyntaxNode`s to `ErasedFileAstId`s and back. | 54 | /// Maps items' `SyntaxNode`s to `ErasedFileAstId`s and back. |
57 | #[derive(Debug, PartialEq, Eq, Default)] | 55 | #[derive(Debug, PartialEq, Eq, Default)] |
58 | pub struct AstIdMap { | 56 | pub struct AstIdMap { |
59 | arena: Arena<ErasedFileAstId, SyntaxNodePtr>, | 57 | arena: Arena<SyntaxNodePtr>, |
60 | } | 58 | } |
61 | 59 | ||
62 | impl AstIdMap { | 60 | impl AstIdMap { |