Reformat all

This commit is contained in:
Aleksey Kladov 2018-10-31 23:41:43 +03:00
parent 857c1650ef
commit 6be50f7d5d
35 changed files with 423 additions and 367 deletions

View file

@ -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())

View file

@ -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::*;

View file

@ -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<StructureNode> {
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<StructureNode> {
stack.push(res.len());
res.push(symbol);
}
},
}
WalkEvent::Leave(node) => {
if structure_node(node).is_some() {
stack.pop().unwrap();