Explorar o código

Avoid manually implementing repeat() with iterators

Victor Song %!s(int64=3) %!d(string=hai) anos
pai
achega
1dc14eaff1
Modificáronse 1 ficheiros con 1 adicións e 3 borrados
  1. 1 3
      src/output/cell.rs

+ 1 - 3
src/output/cell.rs

@@ -77,11 +77,9 @@ impl TextCell {
     ///
     /// This method allocates a `String` to hold the spaces.
     pub fn add_spaces(&mut self, count: usize) {
-        use std::iter::repeat;
-
         (*self.width) += count;
 
-        let spaces: String = repeat(' ').take(count).collect();
+        let spaces: String = " ".repeat(count);
         self.contents.0.push(Style::default().paint(spaces));
     }