From d323c81d5cc6a198239285abcede2166181d8f39 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 2 Oct 2018 18:02:57 +0300 Subject: make ancestors and descendants inherent --- crates/ra_editor/src/folding_ranges.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'crates/ra_editor/src/folding_ranges.rs') diff --git a/crates/ra_editor/src/folding_ranges.rs b/crates/ra_editor/src/folding_ranges.rs index 817da28d1..892aaf97b 100644 --- a/crates/ra_editor/src/folding_ranges.rs +++ b/crates/ra_editor/src/folding_ranges.rs @@ -3,7 +3,7 @@ use std::collections::HashSet; use ra_syntax::{ File, TextRange, SyntaxNodeRef, SyntaxKind, - algo::{walk, Direction, siblings}, + algo::{Direction, siblings}, }; #[derive(Debug, PartialEq, Eq)] @@ -19,12 +19,10 @@ pub struct Fold { } pub fn folding_ranges(file: &File) -> Vec { - let syntax = file.syntax(); - let mut res = vec![]; let mut visited = HashSet::new(); - for node in walk::preorder(syntax) { + for node in file.syntax().descendants() { if visited.contains(&node) { continue; } @@ -139,4 +137,4 @@ fn main() { } -} \ No newline at end of file +} -- cgit v1.2.3