aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/src/descriptors
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_analysis/src/descriptors')
-rw-r--r--crates/ra_analysis/src/descriptors/function/imp.rs4
-rw-r--r--crates/ra_analysis/src/descriptors/module/imp.rs8
-rw-r--r--crates/ra_analysis/src/descriptors/module/mod.rs10
3 files changed, 11 insertions, 11 deletions
diff --git a/crates/ra_analysis/src/descriptors/function/imp.rs b/crates/ra_analysis/src/descriptors/function/imp.rs
index 755e05819..a989a04cd 100644
--- a/crates/ra_analysis/src/descriptors/function/imp.rs
+++ b/crates/ra_analysis/src/descriptors/function/imp.rs
@@ -11,11 +11,11 @@ use crate::descriptors::{
11/// TODO: this should return something more type-safe then `SyntaxNode` 11/// TODO: this should return something more type-safe then `SyntaxNode`
12pub(crate) fn fn_syntax(db: &impl DescriptorDatabase, fn_id: FnId) -> FnDefNode { 12pub(crate) fn fn_syntax(db: &impl DescriptorDatabase, fn_id: FnId) -> FnDefNode {
13 let syntax = db.resolve_syntax_ptr(fn_id.0); 13 let syntax = db.resolve_syntax_ptr(fn_id.0);
14 FnDef::cast(syntax.borrowed()).unwrap().into() 14 FnDef::cast(syntax.borrowed()).unwrap().owned()
15} 15}
16 16
17pub(crate) fn fn_scopes(db: &impl DescriptorDatabase, fn_id: FnId) -> Arc<FnScopes> { 17pub(crate) fn fn_scopes(db: &impl DescriptorDatabase, fn_id: FnId) -> Arc<FnScopes> {
18 let syntax = db.fn_syntax(fn_id); 18 let syntax = db.fn_syntax(fn_id);
19 let res = FnScopes::new(syntax.ast()); 19 let res = FnScopes::new(syntax.borrowed());
20 Arc::new(res) 20 Arc::new(res)
21} 21}
diff --git a/crates/ra_analysis/src/descriptors/module/imp.rs b/crates/ra_analysis/src/descriptors/module/imp.rs
index b3b1f1f21..b5c232ea4 100644
--- a/crates/ra_analysis/src/descriptors/module/imp.rs
+++ b/crates/ra_analysis/src/descriptors/module/imp.rs
@@ -41,9 +41,9 @@ pub(crate) fn submodules(
41 db::check_canceled(db)?; 41 db::check_canceled(db)?;
42 let file_id = source.file_id(); 42 let file_id = source.file_id();
43 let submodules = match source.resolve(db) { 43 let submodules = match source.resolve(db) {
44 ModuleSourceNode::Root(it) => collect_submodules(file_id, it.ast()), 44 ModuleSourceNode::Root(it) => collect_submodules(file_id, it.borrowed()),
45 ModuleSourceNode::Inline(it) => it 45 ModuleSourceNode::Inline(it) => it
46 .ast() 46 .borrowed()
47 .item_list() 47 .item_list()
48 .map(|it| collect_submodules(file_id, it)) 48 .map(|it| collect_submodules(file_id, it))
49 .unwrap_or_else(Vec::new), 49 .unwrap_or_else(Vec::new),
@@ -89,8 +89,8 @@ pub(crate) fn module_scope(
89 let tree = db.module_tree(source_root_id)?; 89 let tree = db.module_tree(source_root_id)?;
90 let source = module_id.source(&tree).resolve(db); 90 let source = module_id.source(&tree).resolve(db);
91 let res = match source { 91 let res = match source {
92 ModuleSourceNode::Root(root) => ModuleScope::new(root.ast().items()), 92 ModuleSourceNode::Root(root) => ModuleScope::new(root.borrowed().items()),
93 ModuleSourceNode::Inline(inline) => match inline.ast().item_list() { 93 ModuleSourceNode::Inline(inline) => match inline.borrowed().item_list() {
94 Some(items) => ModuleScope::new(items.items()), 94 Some(items) => ModuleScope::new(items.items()),
95 None => ModuleScope::new(std::iter::empty()), 95 None => ModuleScope::new(std::iter::empty()),
96 }, 96 },
diff --git a/crates/ra_analysis/src/descriptors/module/mod.rs b/crates/ra_analysis/src/descriptors/module/mod.rs
index 3d799ba05..03330240d 100644
--- a/crates/ra_analysis/src/descriptors/module/mod.rs
+++ b/crates/ra_analysis/src/descriptors/module/mod.rs
@@ -117,7 +117,7 @@ impl ModuleId {
117 .filter_map(|&it| { 117 .filter_map(|&it| {
118 let p = tree.link(it).problem.clone()?; 118 let p = tree.link(it).problem.clone()?;
119 let s = it.bind_source(tree, db); 119 let s = it.bind_source(tree, db);
120 let s = s.ast().name().unwrap().syntax().owned(); 120 let s = s.borrowed().name().unwrap().syntax().owned();
121 Some((s, p)) 121 Some((s, p))
122 }) 122 })
123 .collect() 123 .collect()
@@ -136,11 +136,11 @@ impl LinkId {
136 let owner = self.owner(tree); 136 let owner = self.owner(tree);
137 match owner.source(tree).resolve(db) { 137 match owner.source(tree).resolve(db) {
138 ModuleSourceNode::Root(root) => { 138 ModuleSourceNode::Root(root) => {
139 let ast = imp::modules(root.ast()) 139 let ast = imp::modules(root.borrowed())
140 .find(|(name, _)| name == &tree.link(self).name) 140 .find(|(name, _)| name == &tree.link(self).name)
141 .unwrap() 141 .unwrap()
142 .1; 142 .1;
143 ast.into() 143 ast.owned()
144 } 144 }
145 ModuleSourceNode::Inline(it) => it, 145 ModuleSourceNode::Inline(it) => it,
146 } 146 }
@@ -179,13 +179,13 @@ impl ModuleSource {
179 match self { 179 match self {
180 ModuleSource::File(file_id) => { 180 ModuleSource::File(file_id) => {
181 let syntax = db.file_syntax(file_id); 181 let syntax = db.file_syntax(file_id);
182 ModuleSourceNode::Root(syntax.ast().into()) 182 ModuleSourceNode::Root(syntax.ast().owned())
183 } 183 }
184 ModuleSource::Inline(ptr) => { 184 ModuleSource::Inline(ptr) => {
185 let syntax = db.resolve_syntax_ptr(ptr); 185 let syntax = db.resolve_syntax_ptr(ptr);
186 let syntax = syntax.borrowed(); 186 let syntax = syntax.borrowed();
187 let module = ast::Module::cast(syntax).unwrap(); 187 let module = ast::Module::cast(syntax).unwrap();
188 ModuleSourceNode::Inline(module.into()) 188 ModuleSourceNode::Inline(module.owned())
189 } 189 }
190 } 190 }
191 } 191 }