diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-12-27 21:08:59 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-12-27 21:08:59 +0000 |
commit | e80021cbd0bcfea82f3b855e13a409c73b563673 (patch) | |
tree | a10ff2ac8882d9b0373bc5449a44e40696538a45 /crates/ra_analysis/src/imp.rs | |
parent | efb63a7666cc9532d97fa7e0da14b540ae8bd5df (diff) | |
parent | bc833216d7190d7a270ed2d831abc134fab91cfb (diff) |
Merge #348
348: cleanups r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_analysis/src/imp.rs')
-rw-r--r-- | crates/ra_analysis/src/imp.rs | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index 0471a2fca..e6663810d 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs | |||
@@ -7,10 +7,7 @@ use rayon::prelude::*; | |||
7 | use salsa::{Database, ParallelDatabase}; | 7 | use salsa::{Database, ParallelDatabase}; |
8 | 8 | ||
9 | use hir::{ | 9 | use hir::{ |
10 | self, | 10 | self, FnSignatureInfo, Problem, source_binder, |
11 | FnSignatureInfo, | ||
12 | Problem, | ||
13 | source_binder, | ||
14 | }; | 11 | }; |
15 | use ra_db::{FilesDatabase, SourceRoot, SourceRootId, SyntaxDatabase}; | 12 | use ra_db::{FilesDatabase, SourceRoot, SourceRootId, SyntaxDatabase}; |
16 | use ra_editor::{self, FileSymbol, find_node_at_offset, LineIndex, LocalEdit, Severity}; | 13 | use ra_editor::{self, FileSymbol, find_node_at_offset, LineIndex, LocalEdit, Severity}; |
@@ -123,9 +120,6 @@ impl AnalysisHostImpl { | |||
123 | .query(ra_db::SourceFileQuery) | 120 | .query(ra_db::SourceFileQuery) |
124 | .sweep(salsa::SweepStrategy::default().discard_values()); | 121 | .sweep(salsa::SweepStrategy::default().discard_values()); |
125 | self.db | 122 | self.db |
126 | .query(hir::db::FnSyntaxQuery) | ||
127 | .sweep(salsa::SweepStrategy::default().discard_values()); | ||
128 | self.db | ||
129 | .query(hir::db::SourceFileItemsQuery) | 123 | .query(hir::db::SourceFileItemsQuery) |
130 | .sweep(salsa::SweepStrategy::default().discard_values()); | 124 | .sweep(salsa::SweepStrategy::default().discard_values()); |
131 | self.db | 125 | self.db |
@@ -332,16 +326,6 @@ impl AnalysisImpl { | |||
332 | Ok(Some((binding, descr))) | 326 | Ok(Some((binding, descr))) |
333 | } | 327 | } |
334 | } | 328 | } |
335 | |||
336 | pub fn doc_comment_for( | ||
337 | &self, | ||
338 | file_id: FileId, | ||
339 | symbol: FileSymbol, | ||
340 | ) -> Cancelable<Option<String>> { | ||
341 | let file = self.db.source_file(file_id); | ||
342 | |||
343 | Ok(symbol.docs(&file)) | ||
344 | } | ||
345 | pub fn doc_text_for(&self, file_id: FileId, symbol: FileSymbol) -> Cancelable<Option<String>> { | 329 | pub fn doc_text_for(&self, file_id: FileId, symbol: FileSymbol) -> Cancelable<Option<String>> { |
346 | let file = self.db.source_file(file_id); | 330 | let file = self.db.source_file(file_id); |
347 | let result = match (symbol.description(&file), symbol.docs(&file)) { | 331 | let result = match (symbol.description(&file), symbol.docs(&file)) { |
@@ -507,12 +491,7 @@ impl AnalysisImpl { | |||
507 | let file = self.db.source_file(file_id); | 491 | let file = self.db.source_file(file_id); |
508 | let syntax = file.syntax(); | 492 | let syntax = file.syntax(); |
509 | let node = find_covering_node(syntax, range); | 493 | let node = find_covering_node(syntax, range); |
510 | let parent_fn = node.ancestors().filter_map(FnDef::cast).next(); | 494 | let parent_fn = ctry!(node.ancestors().find_map(FnDef::cast)); |
511 | let parent_fn = if let Some(p) = parent_fn { | ||
512 | p | ||
513 | } else { | ||
514 | return Ok(None); | ||
515 | }; | ||
516 | let function = ctry!(source_binder::function_from_source( | 495 | let function = ctry!(source_binder::function_from_source( |
517 | &*self.db, file_id, parent_fn | 496 | &*self.db, file_id, parent_fn |
518 | )?); | 497 | )?); |