on master help sign in
open_below: drop redundant collect/into_iter.
def949eBlaž Hrastnik
helix-term/src/commands.rs+5−8
@@ -605,15 +605,12 @@ pub fn open_below(cx: &mut Context) {
605
605
606 let lines = selection_lines(&doc.state);
606 let lines = selection_lines(&doc.state);
607
607
608− let positions: Vec<_> = lines
608+ let positions = lines.into_iter().map(|index| {
609− .into_iter()
610− .map(|index| {
611− // adjust all positions to the end of the line/start of the next one.
609+ // adjust all positions to the end of the line/start of the next one.
612− doc.text().line_to_char(index + 1)
610+ doc.text().line_to_char(index + 1)
613− })
611+ });
614− .collect();
615
612
616− let changes = positions.iter().copied().map(|index| {
613+ let changes = positions.map(|index| {
617 // TODO: share logic with insert_newline for indentation
614 // TODO: share logic with insert_newline for indentation
618 let indent_level = helix_core::indent::suggested_indent_for_pos(
615 let indent_level = helix_core::indent::suggested_indent_for_pos(
619 doc.syntax.as_ref(),
616 doc.syntax.as_ref(),