diff options
Diffstat (limited to 'crates/ra_editor/src/structure.rs')
-rw-r--r-- | crates/ra_editor/src/structure.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/ra_editor/src/structure.rs b/crates/ra_editor/src/structure.rs index 32d59e335..8bd57555f 100644 --- a/crates/ra_editor/src/structure.rs +++ b/crates/ra_editor/src/structure.rs | |||
@@ -3,7 +3,7 @@ use crate::TextRange; | |||
3 | use ra_syntax::{ | 3 | use ra_syntax::{ |
4 | algo::visit::{visitor, Visitor}, | 4 | algo::visit::{visitor, Visitor}, |
5 | ast::{self, NameOwner}, | 5 | ast::{self, NameOwner}, |
6 | AstNode, SourceFileNode, SyntaxKind, SyntaxNodeRef, WalkEvent, | 6 | AstNode, SourceFile, SyntaxKind, SyntaxNode, WalkEvent, |
7 | }; | 7 | }; |
8 | 8 | ||
9 | #[derive(Debug, Clone)] | 9 | #[derive(Debug, Clone)] |
@@ -15,7 +15,7 @@ pub struct StructureNode { | |||
15 | pub kind: SyntaxKind, | 15 | pub kind: SyntaxKind, |
16 | } | 16 | } |
17 | 17 | ||
18 | pub fn file_structure(file: &SourceFileNode) -> Vec<StructureNode> { | 18 | pub fn file_structure(file: &SourceFile) -> Vec<StructureNode> { |
19 | let mut res = Vec::new(); | 19 | let mut res = Vec::new(); |
20 | let mut stack = Vec::new(); | 20 | let mut stack = Vec::new(); |
21 | 21 | ||
@@ -38,8 +38,8 @@ pub fn file_structure(file: &SourceFileNode) -> Vec<StructureNode> { | |||
38 | res | 38 | res |
39 | } | 39 | } |
40 | 40 | ||
41 | fn structure_node(node: SyntaxNodeRef) -> Option<StructureNode> { | 41 | fn structure_node(node: &SyntaxNode) -> Option<StructureNode> { |
42 | fn decl<'a, N: NameOwner<'a>>(node: N) -> Option<StructureNode> { | 42 | fn decl<N: NameOwner>(node: &N) -> Option<StructureNode> { |
43 | let name = node.name()?; | 43 | let name = node.name()?; |
44 | Some(StructureNode { | 44 | Some(StructureNode { |
45 | parent: None, | 45 | parent: None, |
@@ -60,7 +60,7 @@ fn structure_node(node: SyntaxNodeRef) -> Option<StructureNode> { | |||
60 | .visit(decl::<ast::TypeDef>) | 60 | .visit(decl::<ast::TypeDef>) |
61 | .visit(decl::<ast::ConstDef>) | 61 | .visit(decl::<ast::ConstDef>) |
62 | .visit(decl::<ast::StaticDef>) | 62 | .visit(decl::<ast::StaticDef>) |
63 | .visit(|im: ast::ImplBlock| { | 63 | .visit(|im: &ast::ImplBlock| { |
64 | let target_type = im.target_type()?; | 64 | let target_type = im.target_type()?; |
65 | let target_trait = im.target_trait(); | 65 | let target_trait = im.target_trait(); |
66 | let label = match target_trait { | 66 | let label = match target_trait { |
@@ -91,7 +91,7 @@ mod tests { | |||
91 | 91 | ||
92 | #[test] | 92 | #[test] |
93 | fn test_file_structure() { | 93 | fn test_file_structure() { |
94 | let file = SourceFileNode::parse( | 94 | let file = SourceFile::parse( |
95 | r#" | 95 | r#" |
96 | struct Foo { | 96 | struct Foo { |
97 | x: i32 | 97 | x: i32 |