diff options
author | Aleksey Kladov <[email protected]> | 2019-12-12 13:58:04 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-12-12 13:58:04 +0000 |
commit | f135a8ea55c0a46c67713fb3b79b5f62ada430c1 (patch) | |
tree | a71a0c4da21cb40c35b6aed842d9664cbec8a59d /crates/ra_hir_def/src/src.rs | |
parent | 63c192b34a54e826afebc735ca6225b44a876eab (diff) |
Move structs to new loc
Diffstat (limited to 'crates/ra_hir_def/src/src.rs')
-rw-r--r-- | crates/ra_hir_def/src/src.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/crates/ra_hir_def/src/src.rs b/crates/ra_hir_def/src/src.rs index 858e4861e..7e212adb1 100644 --- a/crates/ra_hir_def/src/src.rs +++ b/crates/ra_hir_def/src/src.rs | |||
@@ -4,7 +4,9 @@ use hir_expand::InFile; | |||
4 | use ra_arena::map::ArenaMap; | 4 | use ra_arena::map::ArenaMap; |
5 | use ra_syntax::ast; | 5 | use ra_syntax::ast; |
6 | 6 | ||
7 | use crate::{db::DefDatabase, ConstLoc, FunctionLoc, ImplLoc, StaticLoc, TraitLoc, TypeAliasLoc}; | 7 | use crate::{ |
8 | db::DefDatabase, ConstLoc, FunctionLoc, ImplLoc, StaticLoc, StructLoc, TraitLoc, TypeAliasLoc, | ||
9 | }; | ||
8 | 10 | ||
9 | pub trait HasSource { | 11 | pub trait HasSource { |
10 | type Value; | 12 | type Value; |
@@ -65,6 +67,15 @@ impl HasSource for TraitLoc { | |||
65 | } | 67 | } |
66 | } | 68 | } |
67 | 69 | ||
70 | impl HasSource for StructLoc { | ||
71 | type Value = ast::StructDef; | ||
72 | |||
73 | fn source(&self, db: &impl DefDatabase) -> InFile<ast::StructDef> { | ||
74 | let node = self.ast_id.to_node(db); | ||
75 | InFile::new(self.ast_id.file_id, node) | ||
76 | } | ||
77 | } | ||
78 | |||
68 | pub trait HasChildSource { | 79 | pub trait HasChildSource { |
69 | type ChildId; | 80 | type ChildId; |
70 | type Value; | 81 | type Value; |