From 3ceb9a941a9dbb3c4dfa3a217ee3f4de792df0dc Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 16 Jan 2020 17:56:14 +0100 Subject: Remove dead code --- crates/ra_hir_def/src/nameres.rs | 36 ++---------------------------------- 1 file changed, 2 insertions(+), 34 deletions(-) (limited to 'crates/ra_hir_def/src/nameres.rs') 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; use hir_expand::{diagnostics::DiagnosticSink, name::Name, InFile}; use ra_arena::Arena; -use ra_db::{CrateId, Edition, FileId, FilePosition}; +use ra_db::{CrateId, Edition, FileId}; use ra_prof::profile; -use ra_syntax::{ - ast::{self, AstNode}, - SyntaxNode, -}; +use ra_syntax::ast; use rustc_hash::FxHashMap; use crate::{ @@ -255,35 +252,6 @@ pub enum ModuleSource { Module(ast::Module), } -impl ModuleSource { - // FIXME: this methods do not belong here - pub fn from_position(db: &impl DefDatabase, position: FilePosition) -> ModuleSource { - let parse = db.parse(position.file_id); - match &ra_syntax::algo::find_node_at_offset::( - parse.tree().syntax(), - position.offset, - ) { - Some(m) if !m.has_semi() => ModuleSource::Module(m.clone()), - _ => { - let source_file = parse.tree(); - ModuleSource::SourceFile(source_file) - } - } - } - - pub fn from_child_node(db: &impl DefDatabase, child: InFile<&SyntaxNode>) -> ModuleSource { - if let Some(m) = - child.value.ancestors().filter_map(ast::Module::cast).find(|it| !it.has_semi()) - { - ModuleSource::Module(m) - } else { - let file_id = child.file_id.original_file(db); - let source_file = db.parse(file_id).tree(); - ModuleSource::SourceFile(source_file) - } - } -} - mod diagnostics { use hir_expand::diagnostics::DiagnosticSink; use ra_db::RelativePathBuf; -- cgit v1.2.3