aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/symbol_index.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-07-19 12:15:55 +0100
committerbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-07-19 12:15:55 +0100
commitf209843e31af7f0e0212aa28ffec2efad2a70c6f (patch)
tree548227da78a3bea644f57714d075410c0bdf7469 /crates/ra_ide_api/src/symbol_index.rs
parent58d4983ba5745975446d60f2886d96f8d2adf0f2 (diff)
parentd4a66166c002f0a49e41d856a49cb5685ac93202 (diff)
Merge #1545
1545: migrate ra_syntax to the new rowan API r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide_api/src/symbol_index.rs')
-rw-r--r--crates/ra_ide_api/src/symbol_index.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/ra_ide_api/src/symbol_index.rs b/crates/ra_ide_api/src/symbol_index.rs
index 9b3a45319..e784b5f69 100644
--- a/crates/ra_ide_api/src/symbol_index.rs
+++ b/crates/ra_ide_api/src/symbol_index.rs
@@ -61,7 +61,7 @@ fn file_symbols(db: &impl SymbolsDatabase, file_id: FileId) -> Arc<SymbolIndex>
61 db.check_canceled(); 61 db.check_canceled();
62 let parse = db.parse(file_id); 62 let parse = db.parse(file_id);
63 63
64 let symbols = source_file_to_file_symbols(parse.tree(), file_id); 64 let symbols = source_file_to_file_symbols(&parse.tree(), file_id);
65 65
66 // FIXME: add macros here 66 // FIXME: add macros here
67 67
@@ -173,7 +173,7 @@ impl SymbolIndex {
173 files: impl ParallelIterator<Item = (FileId, Parse<ast::SourceFile>)>, 173 files: impl ParallelIterator<Item = (FileId, Parse<ast::SourceFile>)>,
174 ) -> SymbolIndex { 174 ) -> SymbolIndex {
175 let symbols = files 175 let symbols = files
176 .flat_map(|(file_id, file)| source_file_to_file_symbols(file.tree(), file_id)) 176 .flat_map(|(file_id, file)| source_file_to_file_symbols(&file.tree(), file_id))
177 .collect::<Vec<_>>(); 177 .collect::<Vec<_>>();
178 SymbolIndex::new(symbols) 178 SymbolIndex::new(symbols)
179 } 179 }
@@ -249,7 +249,7 @@ fn source_file_to_file_symbols(source_file: &SourceFile, file_id: FileId) -> Vec
249 for event in source_file.syntax().preorder() { 249 for event in source_file.syntax().preorder() {
250 match event { 250 match event {
251 WalkEvent::Enter(node) => { 251 WalkEvent::Enter(node) => {
252 if let Some(mut symbol) = to_file_symbol(node, file_id) { 252 if let Some(mut symbol) = to_file_symbol(&node, file_id) {
253 symbol.container_name = stack.last().cloned(); 253 symbol.container_name = stack.last().cloned();
254 254
255 stack.push(symbol.name.clone()); 255 stack.push(symbol.name.clone());
@@ -258,7 +258,7 @@ fn source_file_to_file_symbols(source_file: &SourceFile, file_id: FileId) -> Vec
258 } 258 }
259 259
260 WalkEvent::Leave(node) => { 260 WalkEvent::Leave(node) => {
261 if to_symbol(node).is_some() { 261 if to_symbol(&node).is_some() {
262 stack.pop(); 262 stack.pop();
263 } 263 }
264 } 264 }
@@ -269,7 +269,7 @@ fn source_file_to_file_symbols(source_file: &SourceFile, file_id: FileId) -> Vec
269} 269}
270 270
271fn to_symbol(node: &SyntaxNode) -> Option<(SmolStr, SyntaxNodePtr, TextRange)> { 271fn to_symbol(node: &SyntaxNode) -> Option<(SmolStr, SyntaxNodePtr, TextRange)> {
272 fn decl<N: NameOwner>(node: &N) -> Option<(SmolStr, SyntaxNodePtr, TextRange)> { 272 fn decl<N: NameOwner>(node: N) -> Option<(SmolStr, SyntaxNodePtr, TextRange)> {
273 let name = node.name()?; 273 let name = node.name()?;
274 let name_range = name.syntax().range(); 274 let name_range = name.syntax().range();
275 let name = name.text().clone(); 275 let name = name.text().clone();