From 6be50f7d5de3737464853a589673375fc0cafa97 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 31 Oct 2018 23:41:43 +0300 Subject: Reformat all --- crates/ra_editor/src/folding_ranges.rs | 12 ++++++++++-- crates/ra_editor/src/lib.rs | 2 -- crates/ra_editor/src/symbols.rs | 10 +++------- 3 files changed, 13 insertions(+), 11 deletions(-) (limited to 'crates/ra_editor/src') diff --git a/crates/ra_editor/src/folding_ranges.rs b/crates/ra_editor/src/folding_ranges.rs index 8b79ea874..0803c8891 100644 --- a/crates/ra_editor/src/folding_ranges.rs +++ b/crates/ra_editor/src/folding_ranges.rs @@ -174,8 +174,16 @@ mod tests { let file = File::parse(&text); let folds = folding_ranges(&file); - assert_eq!(folds.len(), ranges.len(), "The amount of folds is different than the expected amount"); - assert_eq!(folds.len(), fold_kinds.len(), "The amount of fold kinds is different than the expected amount"); + assert_eq!( + folds.len(), + ranges.len(), + "The amount of folds is different than the expected amount" + ); + assert_eq!( + folds.len(), + fold_kinds.len(), + "The amount of fold kinds is different than the expected amount" + ); for ((fold, range), fold_kind) in folds .into_iter() .zip(ranges.into_iter()) diff --git a/crates/ra_editor/src/lib.rs b/crates/ra_editor/src/lib.rs index 02a1b2d45..481f4c9fc 100644 --- a/crates/ra_editor/src/lib.rs +++ b/crates/ra_editor/src/lib.rs @@ -148,8 +148,6 @@ pub fn find_node_at_offset<'a, N: AstNode<'a>>( leaf.ancestors().filter_map(N::cast).next() } - - #[cfg(test)] mod tests { use super::*; 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 @@ use crate::TextRange; use ra_syntax::{ - algo::{ - visit::{visitor, Visitor}, - }, + algo::visit::{visitor, Visitor}, ast::{self, NameOwner}, - AstNode, File, SmolStr, SyntaxKind, SyntaxNodeRef, - WalkEvent, + AstNode, File, SmolStr, SyntaxKind, SyntaxNodeRef, WalkEvent, }; #[derive(Debug, Clone)] @@ -54,7 +51,6 @@ pub fn file_structure(file: &File) -> Vec { let mut res = Vec::new(); let mut stack = Vec::new(); - for event in file.syntax().preorder() { match event { WalkEvent::Enter(node) => { @@ -63,7 +59,7 @@ pub fn file_structure(file: &File) -> Vec { stack.push(res.len()); res.push(symbol); } - }, + } WalkEvent::Leave(node) => { if structure_node(node).is_some() { stack.pop().unwrap(); -- cgit v1.2.3