aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_editor/src/symbols.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_editor/src/symbols.rs')
-rw-r--r--crates/ra_editor/src/symbols.rs10
1 files changed, 3 insertions, 7 deletions
diff --git a/crates/ra_editor/src/symbols.rs b/crates/ra_editor/src/symbols.rs
index 0bab9dd67..4e602d0e3 100644
--- a/crates/ra_editor/src/symbols.rs
+++ b/crates/ra_editor/src/symbols.rs
@@ -1,12 +1,9 @@
1use crate::TextRange; 1use crate::TextRange;
2 2
3use ra_syntax::{ 3use ra_syntax::{
4 algo::{ 4 algo::visit::{visitor, Visitor},
5 visit::{visitor, Visitor},
6 },
7 ast::{self, NameOwner}, 5 ast::{self, NameOwner},
8 AstNode, File, SmolStr, SyntaxKind, SyntaxNodeRef, 6 AstNode, File, SmolStr, SyntaxKind, SyntaxNodeRef, WalkEvent,
9 WalkEvent,
10}; 7};
11 8
12#[derive(Debug, Clone)] 9#[derive(Debug, Clone)]
@@ -54,7 +51,6 @@ pub fn file_structure(file: &File) -> Vec<StructureNode> {
54 let mut res = Vec::new(); 51 let mut res = Vec::new();
55 let mut stack = Vec::new(); 52 let mut stack = Vec::new();
56 53
57
58 for event in file.syntax().preorder() { 54 for event in file.syntax().preorder() {
59 match event { 55 match event {
60 WalkEvent::Enter(node) => { 56 WalkEvent::Enter(node) => {
@@ -63,7 +59,7 @@ pub fn file_structure(file: &File) -> Vec<StructureNode> {
63 stack.push(res.len()); 59 stack.push(res.len());
64 res.push(symbol); 60 res.push(symbol);
65 } 61 }
66 }, 62 }
67 WalkEvent::Leave(node) => { 63 WalkEvent::Leave(node) => {
68 if structure_node(node).is_some() { 64 if structure_node(node).is_some() {
69 stack.pop().unwrap(); 65 stack.pop().unwrap();