From b88775af7fdfb06df922325ab48237592d5afecb Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 7 Jan 2019 16:53:24 +0300 Subject: migrate ra_editor to rowan 0.2 --- crates/ra_editor/src/structure.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'crates/ra_editor/src/structure.rs') 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; use ra_syntax::{ algo::visit::{visitor, Visitor}, ast::{self, NameOwner}, - AstNode, SourceFileNode, SyntaxKind, SyntaxNodeRef, WalkEvent, + AstNode, SourceFile, SyntaxKind, SyntaxNode, WalkEvent, }; #[derive(Debug, Clone)] @@ -15,7 +15,7 @@ pub struct StructureNode { pub kind: SyntaxKind, } -pub fn file_structure(file: &SourceFileNode) -> Vec { +pub fn file_structure(file: &SourceFile) -> Vec { let mut res = Vec::new(); let mut stack = Vec::new(); @@ -38,8 +38,8 @@ pub fn file_structure(file: &SourceFileNode) -> Vec { res } -fn structure_node(node: SyntaxNodeRef) -> Option { - fn decl<'a, N: NameOwner<'a>>(node: N) -> Option { +fn structure_node(node: &SyntaxNode) -> Option { + fn decl(node: &N) -> Option { let name = node.name()?; Some(StructureNode { parent: None, @@ -60,7 +60,7 @@ fn structure_node(node: SyntaxNodeRef) -> Option { .visit(decl::) .visit(decl::) .visit(decl::) - .visit(|im: ast::ImplBlock| { + .visit(|im: &ast::ImplBlock| { let target_type = im.target_type()?; let target_trait = im.target_trait(); let label = match target_trait { @@ -91,7 +91,7 @@ mod tests { #[test] fn test_file_structure() { - let file = SourceFileNode::parse( + let file = SourceFile::parse( r#" struct Foo { x: i32 -- cgit v1.2.3