aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-01-16 16:56:14 +0000
committerAleksey Kladov <[email protected]>2020-01-16 16:56:14 +0000
commit3ceb9a941a9dbb3c4dfa3a217ee3f4de792df0dc (patch)
treee85440f20cc3d8e097c5dfc79a9b20bab27e728d /crates/ra_hir_def/src
parent6bc236253dd9cd8e0729bbb681f0e03b20bc3627 (diff)
Remove dead code
Diffstat (limited to 'crates/ra_hir_def/src')
-rw-r--r--crates/ra_hir_def/src/nameres.rs36
1 files changed, 2 insertions, 34 deletions
diff --git a/crates/ra_hir_def/src/nameres.rs b/crates/ra_hir_def/src/nameres.rs
index e1a6a46df..27c12e46c 100644
--- a/crates/ra_hir_def/src/nameres.rs
+++ b/crates/ra_hir_def/src/nameres.rs
@@ -59,12 +59,9 @@ use std::sync::Arc;
59 59
60use hir_expand::{diagnostics::DiagnosticSink, name::Name, InFile}; 60use hir_expand::{diagnostics::DiagnosticSink, name::Name, InFile};
61use ra_arena::Arena; 61use ra_arena::Arena;
62use ra_db::{CrateId, Edition, FileId, FilePosition}; 62use ra_db::{CrateId, Edition, FileId};
63use ra_prof::profile; 63use ra_prof::profile;
64use ra_syntax::{ 64use ra_syntax::ast;
65 ast::{self, AstNode},
66 SyntaxNode,
67};
68use rustc_hash::FxHashMap; 65use rustc_hash::FxHashMap;
69 66
70use crate::{ 67use crate::{
@@ -255,35 +252,6 @@ pub enum ModuleSource {
255 Module(ast::Module), 252 Module(ast::Module),
256} 253}
257 254
258impl ModuleSource {
259 // FIXME: this methods do not belong here
260 pub fn from_position(db: &impl DefDatabase, position: FilePosition) -> ModuleSource {
261 let parse = db.parse(position.file_id);
262 match &ra_syntax::algo::find_node_at_offset::<ast::Module>(
263 parse.tree().syntax(),
264 position.offset,
265 ) {
266 Some(m) if !m.has_semi() => ModuleSource::Module(m.clone()),
267 _ => {
268 let source_file = parse.tree();
269 ModuleSource::SourceFile(source_file)
270 }
271 }
272 }
273
274 pub fn from_child_node(db: &impl DefDatabase, child: InFile<&SyntaxNode>) -> ModuleSource {
275 if let Some(m) =
276 child.value.ancestors().filter_map(ast::Module::cast).find(|it| !it.has_semi())
277 {
278 ModuleSource::Module(m)
279 } else {
280 let file_id = child.file_id.original_file(db);
281 let source_file = db.parse(file_id).tree();
282 ModuleSource::SourceFile(source_file)
283 }
284 }
285}
286
287mod diagnostics { 255mod diagnostics {
288 use hir_expand::diagnostics::DiagnosticSink; 256 use hir_expand::diagnostics::DiagnosticSink;
289 use ra_db::RelativePathBuf; 257 use ra_db::RelativePathBuf;