From 8467ba8cdb565d865e14e2115cde98cd7692719d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 19 Jul 2019 20:29:59 +0300 Subject: flip syntax text to use internal iteration --- crates/ra_ide_api/src/display/structure.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/ra_ide_api') 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 { fn collapse_ws(node: &SyntaxNode, output: &mut String) { let mut can_insert_ws = false; - for chunk in node.text().chunks() { + node.text().for_each_chunk(|chunk| { for line in chunk.lines() { let line = line.trim(); if line.is_empty() { if can_insert_ws { - output.push_str(" "); + output.push(' '); can_insert_ws = false; } } else { @@ -96,7 +96,7 @@ fn structure_node(node: &SyntaxNode) -> Option { can_insert_ws = true; } } - } + }) } visitor() -- cgit v1.2.3