mirror of
https://github.com/ratatui/ratatui.git
synced 2025-10-02 07:21:24 +00:00
refactor: make use of iter::repeat_n() (#1788)
Applied via clippy --fix. Available since 1.82.0.
This commit is contained in:
parent
c90ba9781e
commit
02e53de0f8
@ -956,9 +956,11 @@ mod tests {
|
|||||||
|
|
||||||
// set_line only sets the style for non-empty cells (unlike Line::render which sets the
|
// set_line only sets the style for non-empty cells (unlike Line::render which sets the
|
||||||
// style for all cells)
|
// style for all cells)
|
||||||
let expected_styles = iter::repeat(color)
|
let expected_styles = iter::repeat_n(color, content.len().min(5))
|
||||||
.take(content.len().min(5))
|
.chain(iter::repeat_n(
|
||||||
.chain(iter::repeat(Color::default()).take(5_usize.saturating_sub(content.len())))
|
Color::default(),
|
||||||
|
5_usize.saturating_sub(content.len()),
|
||||||
|
))
|
||||||
.collect_vec();
|
.collect_vec();
|
||||||
assert_eq!(actual_contents, expected);
|
assert_eq!(actual_contents, expected);
|
||||||
assert_eq!(actual_styles, expected_styles);
|
assert_eq!(actual_styles, expected_styles);
|
||||||
|
@ -534,11 +534,11 @@ impl Scrollbar<'_> {
|
|||||||
// `<`
|
// `<`
|
||||||
iter::once(begin)
|
iter::once(begin)
|
||||||
// `<═══`
|
// `<═══`
|
||||||
.chain(iter::repeat(track).take(track_start_len))
|
.chain(iter::repeat_n(track, track_start_len))
|
||||||
// `<═══█████`
|
// `<═══█████`
|
||||||
.chain(iter::repeat(thumb).take(thumb_len))
|
.chain(iter::repeat_n(thumb, thumb_len))
|
||||||
// `<═══█████═══════`
|
// `<═══█████═══════`
|
||||||
.chain(iter::repeat(track).take(track_end_len))
|
.chain(iter::repeat_n(track, track_end_len))
|
||||||
// `<═══█████═══════>`
|
// `<═══█████═══════>`
|
||||||
.chain(iter::once(end))
|
.chain(iter::once(end))
|
||||||
.flatten()
|
.flatten()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user