Move private API down

This commit is contained in:
kjeremy 2020-01-08 11:33:04 -05:00
parent 1b19a8aa5e
commit c7b2bc1363

View File

@ -16,21 +16,6 @@ use crate::{
goto_definition, references, FilePosition, NavigationTarget, RangeInfo,
};
#[derive(Default)]
struct CallLocations {
funcs: IndexMap<NavigationTarget, Vec<TextRange>>,
}
impl CallLocations {
pub fn add(&mut self, target: &NavigationTarget, range: TextRange) {
self.funcs.entry(target.clone()).or_default().push(range);
}
pub fn into_items(self) -> Vec<CallItem> {
self.funcs.into_iter().map(|(target, ranges)| CallItem { target, ranges }).collect()
}
}
#[derive(Debug, Clone)]
pub struct CallItem {
pub target: NavigationTarget,
@ -146,6 +131,21 @@ pub(crate) fn outgoing_calls(db: &RootDatabase, position: FilePosition) -> Optio
Some(calls.into_items())
}
#[derive(Default)]
struct CallLocations {
funcs: IndexMap<NavigationTarget, Vec<TextRange>>,
}
impl CallLocations {
fn add(&mut self, target: &NavigationTarget, range: TextRange) {
self.funcs.entry(target.clone()).or_default().push(range);
}
fn into_items(self) -> Vec<CallItem> {
self.funcs.into_iter().map(|(target, ranges)| CallItem { target, ranges }).collect()
}
}
#[cfg(test)]
mod tests {
use ra_db::FilePosition;