diff options
author | Aleksey Kladov <[email protected]> | 2019-07-19 18:29:59 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-07-19 18:29:59 +0100 |
commit | 8467ba8cdb565d865e14e2115cde98cd7692719d (patch) | |
tree | 0a38aeef5b06d7f05186e6927a4dd1280fd35396 /crates/ra_ide_api | |
parent | 8f032d6a585d59a9d2e57beeaca903a4fb5eb57b (diff) |
flip syntax text to use internal iteration
Diffstat (limited to 'crates/ra_ide_api')
-rw-r--r-- | crates/ra_ide_api/src/display/structure.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ra_ide_api/src/display/structure.rs b/crates/ra_ide_api/src/display/structure.rs index 2e183d2f6..0b1a8b6e6 100644 --- a/crates/ra_ide_api/src/display/structure.rs +++ b/crates/ra_ide_api/src/display/structure.rs | |||
@@ -83,12 +83,12 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> { | |||
83 | 83 | ||
84 | fn collapse_ws(node: &SyntaxNode, output: &mut String) { | 84 | fn collapse_ws(node: &SyntaxNode, output: &mut String) { |
85 | let mut can_insert_ws = false; | 85 | let mut can_insert_ws = false; |
86 | for chunk in node.text().chunks() { | 86 | node.text().for_each_chunk(|chunk| { |
87 | for line in chunk.lines() { | 87 | for line in chunk.lines() { |
88 | let line = line.trim(); | 88 | let line = line.trim(); |
89 | if line.is_empty() { | 89 | if line.is_empty() { |
90 | if can_insert_ws { | 90 | if can_insert_ws { |
91 | output.push_str(" "); | 91 | output.push(' '); |
92 | can_insert_ws = false; | 92 | can_insert_ws = false; |
93 | } | 93 | } |
94 | } else { | 94 | } else { |
@@ -96,7 +96,7 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> { | |||
96 | can_insert_ws = true; | 96 | can_insert_ws = true; |
97 | } | 97 | } |
98 | } | 98 | } |
99 | } | 99 | }) |
100 | } | 100 | } |
101 | 101 | ||
102 | visitor() | 102 | visitor() |