diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-11-24 14:36:31 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-11-24 14:36:31 +0000 |
commit | 775bd98e5cf7918acf0dd72009ac14cf758ed0ca (patch) | |
tree | bb4e9795f9dc23d710f147faff02e9d8df596d87 /crates/ra_hir_def/src/data.rs | |
parent | 5cc634fa6018b60c7bac5ada2038ca341a91f410 (diff) | |
parent | 21cfa6d529babf868f897b943d67561ea752b9e5 (diff) |
Merge #2385
2385: Some docs r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir_def/src/data.rs')
-rw-r--r-- | crates/ra_hir_def/src/data.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/crates/ra_hir_def/src/data.rs b/crates/ra_hir_def/src/data.rs index 81a8ec18d..68bea34df 100644 --- a/crates/ra_hir_def/src/data.rs +++ b/crates/ra_hir_def/src/data.rs | |||
@@ -200,18 +200,17 @@ pub struct ConstData { | |||
200 | impl ConstData { | 200 | impl ConstData { |
201 | pub(crate) fn const_data_query(db: &impl DefDatabase, konst: ConstId) -> Arc<ConstData> { | 201 | pub(crate) fn const_data_query(db: &impl DefDatabase, konst: ConstId) -> Arc<ConstData> { |
202 | let node = konst.lookup(db).source(db).value; | 202 | let node = konst.lookup(db).source(db).value; |
203 | const_data_for(&node) | 203 | Arc::new(ConstData::new(&node)) |
204 | } | 204 | } |
205 | 205 | ||
206 | pub(crate) fn static_data_query(db: &impl DefDatabase, konst: StaticId) -> Arc<ConstData> { | 206 | pub(crate) fn static_data_query(db: &impl DefDatabase, konst: StaticId) -> Arc<ConstData> { |
207 | let node = konst.lookup(db).source(db).value; | 207 | let node = konst.lookup(db).source(db).value; |
208 | const_data_for(&node) | 208 | Arc::new(ConstData::new(&node)) |
209 | } | 209 | } |
210 | } | ||
211 | 210 | ||
212 | fn const_data_for<N: NameOwner + TypeAscriptionOwner>(node: &N) -> Arc<ConstData> { | 211 | fn new<N: NameOwner + TypeAscriptionOwner>(node: &N) -> ConstData { |
213 | let name = node.name().map(|n| n.as_name()); | 212 | let name = node.name().map(|n| n.as_name()); |
214 | let type_ref = TypeRef::from_ast_opt(node.ascribed_type()); | 213 | let type_ref = TypeRef::from_ast_opt(node.ascribed_type()); |
215 | let sig = ConstData { name, type_ref }; | 214 | ConstData { name, type_ref } |
216 | Arc::new(sig) | 215 | } |
217 | } | 216 | } |