diff options
author | Aleksey Kladov <[email protected]> | 2018-08-16 10:51:40 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-08-16 10:51:40 +0100 |
commit | 7094291573dc819e3115950ec3b2316bd5e9ea33 (patch) | |
tree | be18ef6c5baab68acac484d00277125484d15820 /crates/libeditor/src/symbols.rs | |
parent | 1193c5f829dc96683132c12d5395d7805787af2a (diff) |
tt-attrs
Diffstat (limited to 'crates/libeditor/src/symbols.rs')
-rw-r--r-- | crates/libeditor/src/symbols.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/crates/libeditor/src/symbols.rs b/crates/libeditor/src/symbols.rs index 6f8853770..2585d9579 100644 --- a/crates/libeditor/src/symbols.rs +++ b/crates/libeditor/src/symbols.rs | |||
@@ -26,8 +26,7 @@ pub struct FileSymbol { | |||
26 | } | 26 | } |
27 | 27 | ||
28 | pub fn file_symbols(file: &ast::File) -> Vec<FileSymbol> { | 28 | pub fn file_symbols(file: &ast::File) -> Vec<FileSymbol> { |
29 | let syntax = file.syntax(); | 29 | preorder(file.syntax_ref()) |
30 | preorder(syntax.as_ref()) | ||
31 | .filter_map(to_symbol) | 30 | .filter_map(to_symbol) |
32 | .collect() | 31 | .collect() |
33 | } | 32 | } |
@@ -57,9 +56,8 @@ fn to_symbol(node: SyntaxNodeRef) -> Option<FileSymbol> { | |||
57 | pub fn file_structure(file: &ast::File) -> Vec<StructureNode> { | 56 | pub fn file_structure(file: &ast::File) -> Vec<StructureNode> { |
58 | let mut res = Vec::new(); | 57 | let mut res = Vec::new(); |
59 | let mut stack = Vec::new(); | 58 | let mut stack = Vec::new(); |
60 | let syntax = file.syntax(); | ||
61 | 59 | ||
62 | for event in walk(syntax.as_ref()) { | 60 | for event in walk(file.syntax_ref()) { |
63 | match event { | 61 | match event { |
64 | WalkEvent::Enter(node) => { | 62 | WalkEvent::Enter(node) => { |
65 | match structure_node(node) { | 63 | match structure_node(node) { |