aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/from_source.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-12-12 13:25:59 +0000
committerGitHub <[email protected]>2019-12-12 13:25:59 +0000
commitd8dba7fbe587ba5fb6cfe939083ccd92c61f5827 (patch)
treec50b695604c7d418fc107775b9ec3a6845062751 /crates/ra_hir/src/from_source.rs
parentb2638fcd2cc847e008e1dd7f1739283813b94026 (diff)
parent7b0644d81e52d00a7a6795b187f356213ff68225 (diff)
Merge #2537
2537: Switch to the new location for impls r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/from_source.rs')
-rw-r--r--crates/ra_hir/src/from_source.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/crates/ra_hir/src/from_source.rs b/crates/ra_hir/src/from_source.rs
index 307f3d5bf..b35188a21 100644
--- a/crates/ra_hir/src/from_source.rs
+++ b/crates/ra_hir/src/from_source.rs
@@ -107,8 +107,10 @@ impl FromSource for MacroDef {
107impl FromSource for ImplBlock { 107impl FromSource for ImplBlock {
108 type Ast = ast::ImplBlock; 108 type Ast = ast::ImplBlock;
109 fn from_source(db: &(impl DefDatabase + AstDatabase), src: InFile<Self::Ast>) -> Option<Self> { 109 fn from_source(db: &(impl DefDatabase + AstDatabase), src: InFile<Self::Ast>) -> Option<Self> {
110 let id = from_source(db, src)?; 110 // XXX: use `.parent()` to avoid finding ourselves
111 Some(ImplBlock { id }) 111 let parent = src.value.syntax().parent()?;
112 let container = Container::find(db, src.with_value(parent).as_ref())?;
113 container.child_by_source(db)[keys::IMPL].get(&src).copied().map(ImplBlock::from)
112 } 114 }
113} 115}
114 116