diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-07-19 18:57:33 +0100 |
---|---|---|
committer | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-07-19 18:57:33 +0100 |
commit | fabd4c4304e387ed6bcc29b39d1593666c4cbec9 (patch) | |
tree | b18a0be7255bb070dd7e2ae3b5687bc5f35f0d41 /crates/ra_ide_api | |
parent | d4ffbf2ae092b313b3c750adad398f3aa6fb209b (diff) | |
parent | 002529937075bd69d7f71483d798d6e4f43d1de9 (diff) |
Merge #1556
1556: sane indexing in text r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
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() |