Skip to content

Commit dbe4b1f

Browse files
authored
Merge pull request #47 from Larocceau/avoid-iteration-over-index-instead-of-words
iterate over list instead of it's indexes
2 parents 09b2468 + fdc3fdd commit dbe4b1f

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

src/terminal/game.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,8 @@ pub fn run(mode: Mode, theme: ThemeColors) -> Result<()> {
7878

7979
let (x, y) = super::calc_middle_for_text().context("Failed to calculate terminal size")?;
8080

81-
for i in 0..game.list.len() {
82-
print_words(
83-
x,
84-
y + i as u16,
85-
&game
86-
.list
87-
.get(i)
88-
.context("Failed to get word from list")?
89-
.to_vec(),
90-
&stdout,
91-
&theme,
92-
)?;
81+
for (i, words) in game.list.iter().enumerate() {
82+
print_words(x, y + i as u16, words, &stdout, &theme)?;
9383
stdout
9484
.execute(MoveTo(x, y as u16))
9585
.context("Failed to move cursor")?;

0 commit comments

Comments
 (0)