mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Move private API down
This commit is contained in:
parent
1b19a8aa5e
commit
c7b2bc1363
1 changed files with 15 additions and 15 deletions
|
@ -16,21 +16,6 @@ use crate::{
|
||||||
goto_definition, references, FilePosition, NavigationTarget, RangeInfo,
|
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)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct CallItem {
|
pub struct CallItem {
|
||||||
pub target: NavigationTarget,
|
pub target: NavigationTarget,
|
||||||
|
@ -146,6 +131,21 @@ pub(crate) fn outgoing_calls(db: &RootDatabase, position: FilePosition) -> Optio
|
||||||
Some(calls.into_items())
|
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)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use ra_db::FilePosition;
|
use ra_db::FilePosition;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue