diff options
Diffstat (limited to 'crates/ra_syntax/src/utils.rs')
-rw-r--r-- | crates/ra_syntax/src/utils.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/crates/ra_syntax/src/utils.rs b/crates/ra_syntax/src/utils.rs index df1f4b372..27248ff32 100644 --- a/crates/ra_syntax/src/utils.rs +++ b/crates/ra_syntax/src/utils.rs | |||
@@ -1,8 +1,8 @@ | |||
1 | use std::fmt::Write; | ||
2 | use crate::{ | 1 | use crate::{ |
3 | algo::walk::{walk, WalkEvent}, | 2 | algo::walk::{walk, WalkEvent}, |
4 | SyntaxKind, File, SyntaxNodeRef | 3 | File, SyntaxKind, SyntaxNodeRef, |
5 | }; | 4 | }; |
5 | use std::fmt::Write; | ||
6 | 6 | ||
7 | /// Parse a file and create a string representation of the resulting parse tree. | 7 | /// Parse a file and create a string representation of the resulting parse tree. |
8 | pub fn dump_tree(syntax: SyntaxNodeRef) -> String { | 8 | pub fn dump_tree(syntax: SyntaxNodeRef) -> String { |
@@ -58,9 +58,7 @@ pub(crate) fn validate_block_structure(root: SyntaxNodeRef) { | |||
58 | let mut stack = Vec::new(); | 58 | let mut stack = Vec::new(); |
59 | for node in root.descendants() { | 59 | for node in root.descendants() { |
60 | match node.kind() { | 60 | match node.kind() { |
61 | SyntaxKind::L_CURLY => { | 61 | SyntaxKind::L_CURLY => stack.push(node), |
62 | stack.push(node) | ||
63 | } | ||
64 | SyntaxKind::R_CURLY => { | 62 | SyntaxKind::R_CURLY => { |
65 | if let Some(pair) = stack.pop() { | 63 | if let Some(pair) = stack.pop() { |
66 | assert_eq!( | 64 | assert_eq!( |