mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
Simplify some config serialization stuff
This commit is contained in:
parent
e972dd2385
commit
1dcb11be5d
5 changed files with 108 additions and 108 deletions
|
@ -19,13 +19,6 @@ pub struct CallItem {
|
|||
pub ranges: Vec<TextRange>,
|
||||
}
|
||||
|
||||
impl CallItem {
|
||||
#[cfg(test)]
|
||||
pub(crate) fn debug_render(&self) -> String {
|
||||
format!("{} : {:?}", self.target.debug_render(), self.ranges)
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn call_hierarchy(
|
||||
db: &RootDatabase,
|
||||
position: FilePosition,
|
||||
|
@ -159,6 +152,10 @@ mod tests {
|
|||
expected_incoming: Expect,
|
||||
expected_outgoing: Expect,
|
||||
) {
|
||||
fn debug_render(item: crate::CallItem) -> String {
|
||||
format!("{} : {:?}", item.target.debug_render(), item.ranges)
|
||||
}
|
||||
|
||||
let (analysis, pos) = fixture::position(ra_fixture);
|
||||
|
||||
let mut navs = analysis.call_hierarchy(pos).unwrap().unwrap().info;
|
||||
|
@ -169,12 +166,10 @@ mod tests {
|
|||
let item_pos =
|
||||
FilePosition { file_id: nav.file_id, offset: nav.focus_or_full_range().start() };
|
||||
let incoming_calls = analysis.incoming_calls(item_pos).unwrap().unwrap();
|
||||
expected_incoming
|
||||
.assert_eq(&incoming_calls.into_iter().map(|call| call.debug_render()).join("\n"));
|
||||
expected_incoming.assert_eq(&incoming_calls.into_iter().map(debug_render).join("\n"));
|
||||
|
||||
let outgoing_calls = analysis.outgoing_calls(item_pos).unwrap().unwrap();
|
||||
expected_outgoing
|
||||
.assert_eq(&outgoing_calls.into_iter().map(|call| call.debug_render()).join("\n"));
|
||||
expected_outgoing.assert_eq(&outgoing_calls.into_iter().map(debug_render).join("\n"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue