refactor: simpify string repeat

This commit is contained in:
EdJoPaTo
2021-06-13 09:29:23 +02:00
parent 127c3c2345
commit de79f19b82
+1 -4
View File
@@ -2,7 +2,6 @@
use crate::identifier::{TreeIdentifier, TreeIdentifierVec}; use crate::identifier::{TreeIdentifier, TreeIdentifierVec};
use std::collections::HashSet; use std::collections::HashSet;
use std::iter;
use tui::buffer::Buffer; use tui::buffer::Buffer;
use tui::layout::{Corner, Rect}; use tui::layout::{Corner, Rect};
use tui::style::Style; use tui::style::Style;
@@ -245,9 +244,7 @@ impl<'a> StatefulWidget for Tree<'a> {
state.offset = start; state.offset = start;
let highlight_symbol = self.highlight_symbol.unwrap_or(""); let highlight_symbol = self.highlight_symbol.unwrap_or("");
let blank_symbol = iter::repeat(" ") let blank_symbol = " ".repeat(highlight_symbol.width());
.take(highlight_symbol.width())
.collect::<String>();
let mut current_height = 0; let mut current_height = 0;
let has_selection = !state.selected.is_empty(); let has_selection = !state.selected.is_empty();