From dddbac68779d068cabfa511bed4ba105bc43d194 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 27 Dec 2018 23:51:44 +0300 Subject: remove FnId --- crates/ra_analysis/src/db.rs | 1 - crates/ra_analysis/src/imp.rs | 3 --- 2 files changed, 4 deletions(-) (limited to 'crates/ra_analysis') diff --git a/crates/ra_analysis/src/db.rs b/crates/ra_analysis/src/db.rs index 036e284bf..b072a5eba 100644 --- a/crates/ra_analysis/src/db.rs +++ b/crates/ra_analysis/src/db.rs @@ -91,7 +91,6 @@ salsa::database_storage! { fn file_item() for hir::db::FileItemQuery; fn input_module_items() for hir::db::InputModuleItemsQuery; fn item_map() for hir::db::ItemMapQuery; - fn fn_syntax() for hir::db::FnSyntaxQuery; fn submodules() for hir::db::SubmodulesQuery; fn infer() for hir::db::InferQuery; fn type_for_def() for hir::db::TypeForDefQuery; diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index 0471a2fca..14c8d58f1 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs @@ -122,9 +122,6 @@ impl AnalysisHostImpl { self.db .query(ra_db::SourceFileQuery) .sweep(salsa::SweepStrategy::default().discard_values()); - self.db - .query(hir::db::FnSyntaxQuery) - .sweep(salsa::SweepStrategy::default().discard_values()); self.db .query(hir::db::SourceFileItemsQuery) .sweep(salsa::SweepStrategy::default().discard_values()); -- cgit v1.2.3 From 58a631f39ab7d3219d7972a26f79b0716024adb3 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 28 Dec 2018 00:01:56 +0300 Subject: dead code --- crates/ra_analysis/src/imp.rs | 15 +-------------- crates/ra_analysis/src/lib.rs | 7 ------- 2 files changed, 1 insertion(+), 21 deletions(-) (limited to 'crates/ra_analysis') diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index 14c8d58f1..2556c022b 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs @@ -7,10 +7,7 @@ use rayon::prelude::*; use salsa::{Database, ParallelDatabase}; use hir::{ - self, - FnSignatureInfo, - Problem, - source_binder, + self, FnSignatureInfo, Problem, source_binder, }; use ra_db::{FilesDatabase, SourceRoot, SourceRootId, SyntaxDatabase}; use ra_editor::{self, FileSymbol, find_node_at_offset, LineIndex, LocalEdit, Severity}; @@ -329,16 +326,6 @@ impl AnalysisImpl { Ok(Some((binding, descr))) } } - - pub fn doc_comment_for( - &self, - file_id: FileId, - symbol: FileSymbol, - ) -> Cancelable> { - let file = self.db.source_file(file_id); - - Ok(symbol.docs(&file)) - } pub fn doc_text_for(&self, file_id: FileId, symbol: FileSymbol) -> Cancelable> { let file = self.db.source_file(file_id); let result = match (symbol.description(&file), symbol.docs(&file)) { diff --git a/crates/ra_analysis/src/lib.rs b/crates/ra_analysis/src/lib.rs index 476d1b438..65c3eb3ec 100644 --- a/crates/ra_analysis/src/lib.rs +++ b/crates/ra_analysis/src/lib.rs @@ -323,13 +323,6 @@ impl Analysis { pub fn find_all_refs(&self, position: FilePosition) -> Cancelable> { self.imp.find_all_refs(position) } - pub fn doc_comment_for( - &self, - file_id: FileId, - symbol: FileSymbol, - ) -> Cancelable> { - self.imp.doc_comment_for(file_id, symbol) - } pub fn doc_text_for(&self, file_id: FileId, symbol: FileSymbol) -> Cancelable> { self.imp.doc_text_for(file_id, symbol) } -- cgit v1.2.3 From bc833216d7190d7a270ed2d831abc134fab91cfb Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 28 Dec 2018 00:08:33 +0300 Subject: simplify --- crates/ra_analysis/src/imp.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'crates/ra_analysis') diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index 2556c022b..e6663810d 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs @@ -491,12 +491,7 @@ impl AnalysisImpl { let file = self.db.source_file(file_id); let syntax = file.syntax(); let node = find_covering_node(syntax, range); - let parent_fn = node.ancestors().filter_map(FnDef::cast).next(); - let parent_fn = if let Some(p) = parent_fn { - p - } else { - return Ok(None); - }; + let parent_fn = ctry!(node.ancestors().find_map(FnDef::cast)); let function = ctry!(source_binder::function_from_source( &*self.db, file_id, parent_fn )?); -- cgit v1.2.3