mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-11-25 05:17:34 +00:00
Avoid manually implementing repeat() with iterators
This commit is contained in:
parent
d24ca084a3
commit
1dc14eaff1
@ -77,11 +77,9 @@ impl TextCell {
|
|||||||
///
|
///
|
||||||
/// This method allocates a `String` to hold the spaces.
|
/// This method allocates a `String` to hold the spaces.
|
||||||
pub fn add_spaces(&mut self, count: usize) {
|
pub fn add_spaces(&mut self, count: usize) {
|
||||||
use std::iter::repeat;
|
|
||||||
|
|
||||||
(*self.width) += count;
|
(*self.width) += count;
|
||||||
|
|
||||||
let spaces: String = repeat(' ').take(count).collect();
|
let spaces: String = " ".repeat(count);
|
||||||
self.contents.0.push(Style::default().paint(spaces));
|
self.contents.0.push(Style::default().paint(spaces));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user