1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2024-11-08 09:09:17 +01:00

Fix lifetimes

This commit is contained in:
mo8it 2024-04-07 13:12:40 +02:00
parent b0a4750624
commit 2db86833a9

@ -16,27 +16,31 @@ use std::io;
use crate::{exercise::Exercise, state::State};
fn rows<'s, 'e>(state: &'s State, exercises: &'e [Exercise]) -> impl Iterator<Item = Row<'e>> + 's
fn rows<'s, 'e, 'i>(
state: &'s State,
exercises: &'e [Exercise],
) -> impl Iterator<Item = Row<'e>> + 'i
where
'e: 's,
's: 'i,
'e: 'i,
{
exercises
.iter()
.zip(state.progress())
.enumerate()
.map(|(ind, (exercise, done))| {
let exercise_state = if *done {
"DONE".green()
} else {
"PENDING".yellow()
};
let next = if ind == state.next_exercise_ind() {
">>>>".bold().red()
} else {
Span::default()
};
let exercise_state = if *done {
"DONE".green()
} else {
"PENDING".yellow()
};
Row::new([
next,
exercise_state,