diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-02-25 12:51:36 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-02-25 12:51:36 +0000 |
commit | 744ec58bc3c6bc0fbffda3c9bf5ad975a1542702 (patch) | |
tree | eda6e27372d87a84556528ce27602fa0dda2b2cf /crates | |
parent | 3853a3b6436e48a7e13dc75bfe6391fa1275f235 (diff) | |
parent | 6542ab89ceb32d6ec108a28ad9d938d24762c029 (diff) |
Merge #3303
3303: Simplify r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_ide/src/call_hierarchy.rs | 20 | ||||
-rw-r--r-- | crates/ra_ide/src/display/navigation_target.rs | 2 |
2 files changed, 7 insertions, 15 deletions
diff --git a/crates/ra_ide/src/call_hierarchy.rs b/crates/ra_ide/src/call_hierarchy.rs index f984f40ad..51ac59a71 100644 --- a/crates/ra_ide/src/call_hierarchy.rs +++ b/crates/ra_ide/src/call_hierarchy.rs | |||
@@ -4,16 +4,11 @@ use indexmap::IndexMap; | |||
4 | 4 | ||
5 | use hir::db::AstDatabase; | 5 | use hir::db::AstDatabase; |
6 | use ra_ide_db::RootDatabase; | 6 | use ra_ide_db::RootDatabase; |
7 | use ra_syntax::{ | 7 | use ra_syntax::{ast, match_ast, AstNode, TextRange}; |
8 | ast::{self, DocCommentsOwner}, | ||
9 | match_ast, AstNode, TextRange, | ||
10 | }; | ||
11 | 8 | ||
12 | use crate::{ | 9 | use crate::{ |
13 | call_info::FnCallNode, | 10 | call_info::FnCallNode, display::ToNav, expand::descend_into_macros, goto_definition, |
14 | display::{ShortLabel, ToNav}, | 11 | references, FilePosition, NavigationTarget, RangeInfo, |
15 | expand::descend_into_macros, | ||
16 | goto_definition, references, FilePosition, NavigationTarget, RangeInfo, | ||
17 | }; | 12 | }; |
18 | 13 | ||
19 | #[derive(Debug, Clone)] | 14 | #[derive(Debug, Clone)] |
@@ -49,6 +44,7 @@ pub(crate) fn incoming_calls(db: &RootDatabase, position: FilePosition) -> Optio | |||
49 | let refs = references::find_all_refs(db, position, None)?; | 44 | let refs = references::find_all_refs(db, position, None)?; |
50 | 45 | ||
51 | let mut calls = CallLocations::default(); | 46 | let mut calls = CallLocations::default(); |
47 | let mut sb = hir::SourceBinder::new(db); | ||
52 | 48 | ||
53 | for reference in refs.info.references() { | 49 | for reference in refs.info.references() { |
54 | let file_id = reference.file_range.file_id; | 50 | let file_id = reference.file_range.file_id; |
@@ -62,12 +58,8 @@ pub(crate) fn incoming_calls(db: &RootDatabase, position: FilePosition) -> Optio | |||
62 | match_ast! { | 58 | match_ast! { |
63 | match node { | 59 | match node { |
64 | ast::FnDef(it) => { | 60 | ast::FnDef(it) => { |
65 | Some(NavigationTarget::from_named( | 61 | let def = sb.to_def(token.with_value(it))?; |
66 | db, | 62 | Some(def.to_nav(sb.db)) |
67 | token.with_value(&it), | ||
68 | it.doc_comment_text(), | ||
69 | it.short_label(), | ||
70 | )) | ||
71 | }, | 63 | }, |
72 | _ => { None }, | 64 | _ => { None }, |
73 | } | 65 | } |
diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs index b42cb477e..c9d0058a6 100644 --- a/crates/ra_ide/src/display/navigation_target.rs +++ b/crates/ra_ide/src/display/navigation_target.rs | |||
@@ -125,7 +125,7 @@ impl NavigationTarget { | |||
125 | } | 125 | } |
126 | 126 | ||
127 | /// Allows `NavigationTarget` to be created from a `NameOwner` | 127 | /// Allows `NavigationTarget` to be created from a `NameOwner` |
128 | pub(crate) fn from_named( | 128 | fn from_named( |
129 | db: &RootDatabase, | 129 | db: &RootDatabase, |
130 | node: InFile<&dyn ast::NameOwner>, | 130 | node: InFile<&dyn ast::NameOwner>, |
131 | docs: Option<String>, | 131 | docs: Option<String>, |