aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src
diff options
context:
space:
mode:
authorVille Penttinen <[email protected]>2019-02-13 16:02:18 +0000
committerVille Penttinen <[email protected]>2019-02-13 16:02:18 +0000
commit3973974de133867c46727ed516b0445d7f1cb63f (patch)
treee6cf41c089cdc6f94a55ee4b9350683f3c0bd27c /crates/ra_ide_api/src
parent0c37a9cc28a38e87a136e0cad9dcc5512c64029c (diff)
Fix possible issue where unnamed is_symbol_def would pop stack wrongly
This removes is_symbol_def as unnecessary.
Diffstat (limited to 'crates/ra_ide_api/src')
-rw-r--r--crates/ra_ide_api/src/symbol_index.rs12
1 files changed, 1 insertions, 11 deletions
diff --git a/crates/ra_ide_api/src/symbol_index.rs b/crates/ra_ide_api/src/symbol_index.rs
index 100df8279..afb10fa92 100644
--- a/crates/ra_ide_api/src/symbol_index.rs
+++ b/crates/ra_ide_api/src/symbol_index.rs
@@ -200,16 +200,6 @@ fn is_type(kind: SyntaxKind) -> bool {
200 } 200 }
201} 201}
202 202
203fn is_symbol_def(kind: SyntaxKind) -> bool {
204 match kind {
205 FN_DEF | STRUCT_DEF | ENUM_DEF | TRAIT_DEF | MODULE | TYPE_DEF | CONST_DEF | STATIC_DEF => {
206 true
207 }
208
209 _ => false,
210 }
211}
212
213/// The actual data that is stored in the index. It should be as compact as 203/// The actual data that is stored in the index. It should be as compact as
214/// possible. 204/// possible.
215#[derive(Debug, Clone, PartialEq, Eq, Hash)] 205#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -236,7 +226,7 @@ fn source_file_to_file_symbols(source_file: &SourceFile, file_id: FileId) -> Vec
236 } 226 }
237 227
238 WalkEvent::Leave(node) => { 228 WalkEvent::Leave(node) => {
239 if is_symbol_def(node.kind()) { 229 if to_symbol(node).is_some() {
240 stack.pop(); 230 stack.pop();
241 } 231 }
242 } 232 }