From 9bb2a742564fc893f5b8e1e605c760798e102765 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 3 Jan 2019 19:55:34 +0300 Subject: embed file_id into FileSymbol --- crates/ra_analysis/src/lib.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'crates/ra_analysis/src/lib.rs') diff --git a/crates/ra_analysis/src/lib.rs b/crates/ra_analysis/src/lib.rs index 61af676b2..ab935954c 100644 --- a/crates/ra_analysis/src/lib.rs +++ b/crates/ra_analysis/src/lib.rs @@ -237,11 +237,11 @@ pub struct NavigationTarget { } impl NavigationTarget { - fn from_symbol(file_id: FileId, symbol: FileSymbol) -> NavigationTarget { + fn from_symbol(symbol: FileSymbol) -> NavigationTarget { NavigationTarget { + file_id: symbol.file_id, name: symbol.name.clone(), kind: symbol.ptr.kind(), - file_id, range: symbol.ptr.range(), ptr: Some(symbol.ptr.clone()), } @@ -278,11 +278,6 @@ impl ReferenceResolution { resolves_to: Vec::new(), } } - - fn add_resolution(&mut self, file_id: FileId, symbol: FileSymbol) { - self.resolves_to - .push(NavigationTarget::from_symbol(file_id, symbol)) - } } /// `AnalysisHost` stores the current state of the world. @@ -380,7 +375,7 @@ impl Analysis { pub fn symbol_search(&self, query: Query) -> Cancelable> { let res = symbol_index::world_symbols(&*self.db, query)? .into_iter() - .map(|(file_id, symbol)| NavigationTarget::from_symbol(file_id, symbol)) + .map(NavigationTarget::from_symbol) .collect(); Ok(res) } -- cgit v1.2.3