From 2db86833a9f3fae4dc5410aac828b3071dda1984 Mon Sep 17 00:00:00 2001 From: mo8it Date: Sun, 7 Apr 2024 13:12:40 +0200 Subject: [PATCH] Fix lifetimes --- src/list.rs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/list.rs b/src/list.rs index bb5ba1c0..5153e01f 100644 --- a/src/list.rs +++ b/src/list.rs @@ -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> + 's +fn rows<'s, 'e, 'i>( + state: &'s State, + exercises: &'e [Exercise], +) -> impl Iterator> + '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,