diff options
Diffstat (limited to 'crates/ra_hir/src/from_source.rs')
-rw-r--r-- | crates/ra_hir/src/from_source.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/ra_hir/src/from_source.rs b/crates/ra_hir/src/from_source.rs index f3194595f..7b6d9b240 100644 --- a/crates/ra_hir/src/from_source.rs +++ b/crates/ra_hir/src/from_source.rs | |||
@@ -137,7 +137,7 @@ impl ModuleSource { | |||
137 | match &find_node_at_offset::<ast::Module>(parse.tree().syntax(), position.offset) { | 137 | match &find_node_at_offset::<ast::Module>(parse.tree().syntax(), position.offset) { |
138 | Some(m) if !m.has_semi() => ModuleSource::Module(m.clone()), | 138 | Some(m) if !m.has_semi() => ModuleSource::Module(m.clone()), |
139 | _ => { | 139 | _ => { |
140 | let source_file = parse.tree().to_owned(); | 140 | let source_file = parse.tree(); |
141 | ModuleSource::SourceFile(source_file) | 141 | ModuleSource::SourceFile(source_file) |
142 | } | 142 | } |
143 | } | 143 | } |
@@ -149,15 +149,15 @@ impl ModuleSource { | |||
149 | child: &SyntaxNode, | 149 | child: &SyntaxNode, |
150 | ) -> ModuleSource { | 150 | ) -> ModuleSource { |
151 | if let Some(m) = child.ancestors().filter_map(ast::Module::cast).find(|it| !it.has_semi()) { | 151 | if let Some(m) = child.ancestors().filter_map(ast::Module::cast).find(|it| !it.has_semi()) { |
152 | ModuleSource::Module(m.clone()) | 152 | ModuleSource::Module(m) |
153 | } else { | 153 | } else { |
154 | let source_file = db.parse(file_id).tree().to_owned(); | 154 | let source_file = db.parse(file_id).tree(); |
155 | ModuleSource::SourceFile(source_file) | 155 | ModuleSource::SourceFile(source_file) |
156 | } | 156 | } |
157 | } | 157 | } |
158 | 158 | ||
159 | pub fn from_file_id(db: &(impl DefDatabase + AstDatabase), file_id: FileId) -> ModuleSource { | 159 | pub fn from_file_id(db: &(impl DefDatabase + AstDatabase), file_id: FileId) -> ModuleSource { |
160 | let source_file = db.parse(file_id).tree().to_owned(); | 160 | let source_file = db.parse(file_id).tree(); |
161 | ModuleSource::SourceFile(source_file) | 161 | ModuleSource::SourceFile(source_file) |
162 | } | 162 | } |
163 | } | 163 | } |