aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkjeremy <[email protected]>2020-01-08 16:33:04 +0000
committerkjeremy <[email protected]>2020-01-08 16:33:04 +0000
commitc7b2bc1363c8422122a0d1fbd5ff68b5984cf173 (patch)
treee4f8f3dac6a05b92247e75c9bba71a2e6afd5745
parent1b19a8aa5ecfc9d7115f291b97d413bd845c89b5 (diff)
Move private API down
-rw-r--r--crates/ra_ide/src/call_hierarchy.rs30
1 files changed, 15 insertions, 15 deletions
diff --git a/crates/ra_ide/src/call_hierarchy.rs b/crates/ra_ide/src/call_hierarchy.rs
index 75658c20b..1cb712e32 100644
--- a/crates/ra_ide/src/call_hierarchy.rs
+++ b/crates/ra_ide/src/call_hierarchy.rs
@@ -16,21 +16,6 @@ use crate::{
16 goto_definition, references, FilePosition, NavigationTarget, RangeInfo, 16 goto_definition, references, FilePosition, NavigationTarget, RangeInfo,
17}; 17};
18 18
19#[derive(Default)]
20struct CallLocations {
21 funcs: IndexMap<NavigationTarget, Vec<TextRange>>,
22}
23
24impl CallLocations {
25 pub fn add(&mut self, target: &NavigationTarget, range: TextRange) {
26 self.funcs.entry(target.clone()).or_default().push(range);
27 }
28
29 pub fn into_items(self) -> Vec<CallItem> {
30 self.funcs.into_iter().map(|(target, ranges)| CallItem { target, ranges }).collect()
31 }
32}
33
34#[derive(Debug, Clone)] 19#[derive(Debug, Clone)]
35pub struct CallItem { 20pub struct CallItem {
36 pub target: NavigationTarget, 21 pub target: NavigationTarget,
@@ -146,6 +131,21 @@ pub(crate) fn outgoing_calls(db: &RootDatabase, position: FilePosition) -> Optio
146 Some(calls.into_items()) 131 Some(calls.into_items())
147} 132}
148 133
134#[derive(Default)]
135struct CallLocations {
136 funcs: IndexMap<NavigationTarget, Vec<TextRange>>,
137}
138
139impl CallLocations {
140 fn add(&mut self, target: &NavigationTarget, range: TextRange) {
141 self.funcs.entry(target.clone()).or_default().push(range);
142 }
143
144 fn into_items(self) -> Vec<CallItem> {
145 self.funcs.into_iter().map(|(target, ranges)| CallItem { target, ranges }).collect()
146 }
147}
148
149#[cfg(test)] 149#[cfg(test)]
150mod tests { 150mod tests {
151 use ra_db::FilePosition; 151 use ra_db::FilePosition;