Skip to content

Commit 0ecb03a

Browse files
David Tolnayfacebook-github-bot
authored andcommitted
Resolve manual_repeat_n clippy lint
Summary: ```lang=text warning: this `repeat().take()` can be written more concisely --> fbcode/buck2/app/buck2_data/src/lib.rs:122:32 | 122 | .chain(std::iter::repeat('.').take(3)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `repeat_n()` instead: `std::iter::repeat_n('.', 3)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_repeat_n = note: `-W clippy::manual-repeat-n` implied by `-W clippy::all` = help: to override `-W clippy::all` add `#[allow(clippy::manual_repeat_n)]` warning: this `repeat().take()` can be written more concisely --> fbcode/buck2/superconsole/src/content/lines.rs:248:24 | 248 | let extender = iter::repeat(Line::default()).take(amount); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `repeat_n()` instead: `std::iter::repeat_n(Line::default(), amount)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_repeat_n = note: `-W clippy::manual-repeat-n` implied by `-W clippy::all` = help: to override `-W clippy::all` add `#[allow(clippy::manual_repeat_n)]` warning: this `repeat().take()` can be written more concisely --> fbcode/buck2/superconsole/src/content/lines.rs:254:24 | 254 | let extender = iter::repeat(Line::default()).take(amount); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `repeat_n()` instead: `std::iter::repeat_n(Line::default(), amount)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_repeat_n warning: this `repeat().take()` can be written more concisely --> fbcode/buck2/superconsole/src/components/splitting.rs:355:27 | 355 | output.extend(iter::repeat(Line::default()).take(8)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `repeat_n()` instead: `std::iter::repeat_n(Line::default(), 8)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_repeat_n = note: `-W clippy::manual-repeat-n` implied by `-W clippy::all` = help: to override `-W clippy::all` add `#[allow(clippy::manual_repeat_n)]` warning: this `repeat().take()` can be written more concisely --> fbcode/buck2/superconsole/src/components/splitting.rs:357:27 | 357 | output.extend(iter::repeat(Line::default()).take(7)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `repeat_n()` instead: `std::iter::repeat_n(Line::default(), 7)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_repeat_n warning: this `repeat().take()` can be written more concisely --> fbcode/buck2/superconsole/src/content/lines.rs:248:24 | 248 | let extender = iter::repeat(Line::default()).take(amount); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `repeat_n()` instead: `std::iter::repeat_n(Line::default(), amount)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_repeat_n errors: 0; warnings: 6 ``` Reviewed By: diliop Differential Revision: D72737417 fbshipit-source-id: 133332287e92073c7bf6695bf06ec6a51a8ee1d7
1 parent 0d4cd96 commit 0ecb03a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/components/splitting.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,9 @@ mod tests {
352352
);
353353

354354
let mut output = top;
355-
output.extend(iter::repeat(Line::default()).take(8));
355+
output.extend(iter::repeat_n(Line::default(), 8));
356356
output.extend(bottom);
357-
output.extend(iter::repeat(Line::default()).take(7));
357+
output.extend(iter::repeat_n(Line::default(), 7));
358358

359359
let drawn = splitter
360360
.draw(Dimensions::new(20, 20), DrawMode::Normal)

src/content/lines.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,13 +245,13 @@ impl Lines {
245245

246246
/// Extends the Lines list by the given length, adding empty lines at the bottom
247247
pub fn pad_lines_bottom(&mut self, amount: usize) {
248-
let extender = iter::repeat(Line::default()).take(amount);
248+
let extender = iter::repeat_n(Line::default(), amount);
249249
self.extend(extender);
250250
}
251251

252252
/// Same functionality as `pad_lines_bottom` but on the top.
253253
pub fn pad_lines_top(&mut self, amount: usize) {
254-
let extender = iter::repeat(Line::default()).take(amount);
254+
let extender = iter::repeat_n(Line::default(), amount);
255255

256256
self.0.splice(0..0, extender);
257257
}

0 commit comments

Comments
 (0)