diff options
author | Aleksey Kladov <[email protected]> | 2019-06-11 15:40:18 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-06-11 16:28:51 +0100 |
commit | 8b94b429e5a76a0518b07111f8faf0dca7457948 (patch) | |
tree | 32291a105de42f0494fa687cb6c3f0f718d7aea8 /crates/ra_hir/src | |
parent | a6e339e822bcba4d81f1ab3912ca9612be9b6a0a (diff) |
use Source for MacroDef
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r-- | crates/ra_hir/src/code_model.rs | 15 | ||||
-rw-r--r-- | crates/ra_hir/src/docs.rs | 2 |
2 files changed, 11 insertions, 6 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 5b56f890e..adb61a804 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs | |||
@@ -1003,12 +1003,17 @@ pub struct MacroDef { | |||
1003 | pub(crate) id: MacroDefId, | 1003 | pub(crate) id: MacroDefId, |
1004 | } | 1004 | } |
1005 | 1005 | ||
1006 | impl HasSource for MacroDef { | ||
1007 | type Ast = TreeArc<ast::MacroCall>; | ||
1008 | |||
1009 | fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source<TreeArc<ast::MacroCall>> { | ||
1010 | (self.id.0.file_id(), self.id.0.to_node(db)).into() | ||
1011 | } | ||
1012 | } | ||
1013 | |||
1006 | impl MacroDef { | 1014 | impl MacroDef { |
1007 | pub fn source( | 1015 | pub fn source(&self, db: &(impl DefDatabase + AstDatabase)) -> Source<TreeArc<ast::MacroCall>> { |
1008 | &self, | 1016 | (self.id.0.file_id(), self.id.0.to_node(db)).into() |
1009 | db: &(impl DefDatabase + AstDatabase), | ||
1010 | ) -> (HirFileId, TreeArc<ast::MacroCall>) { | ||
1011 | (self.id.0.file_id(), self.id.0.to_node(db)) | ||
1012 | } | 1017 | } |
1013 | } | 1018 | } |
1014 | 1019 | ||
diff --git a/crates/ra_hir/src/docs.rs b/crates/ra_hir/src/docs.rs index f736f3875..cbf7ae10b 100644 --- a/crates/ra_hir/src/docs.rs +++ b/crates/ra_hir/src/docs.rs | |||
@@ -85,7 +85,7 @@ pub(crate) fn documentation_query( | |||
85 | DocDef::Union(it) => docs_from_ast(&*it.source(db).ast), | 85 | DocDef::Union(it) => docs_from_ast(&*it.source(db).ast), |
86 | DocDef::Trait(it) => docs_from_ast(&*it.source(db).ast), | 86 | DocDef::Trait(it) => docs_from_ast(&*it.source(db).ast), |
87 | DocDef::TypeAlias(it) => docs_from_ast(&*it.source(db).ast), | 87 | DocDef::TypeAlias(it) => docs_from_ast(&*it.source(db).ast), |
88 | DocDef::MacroDef(it) => docs_from_ast(&*it.source(db).1), | 88 | DocDef::MacroDef(it) => docs_from_ast(&*it.source(db).ast), |
89 | } | 89 | } |
90 | } | 90 | } |
91 | 91 | ||