diff options
author | Joris | 2023-03-05 20:32:12 +0100 |
---|---|---|
committer | Joris | 2023-03-05 20:32:12 +0100 |
commit | 7eaa68fcd906adcf320dced96779cafb1f8400e7 (patch) | |
tree | ade5277df3b4f3cc7a80d198a6a97f867b2340c4 /src/gui | |
parent | 8987c94b3654dd4ef40bea6745886a514bfa4532 (diff) |
Fix clippy warnings
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/question.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/gui/question.rs b/src/gui/question.rs index 1c44272..c07b5f4 100644 --- a/src/gui/question.rs +++ b/src/gui/question.rs @@ -182,14 +182,17 @@ pub fn ask<B: Backend>(terminal: &mut Terminal<B>, title: &str, card: &Card) -> difficulty: selected, } => match key.code { KeyCode::Left => { - for d in relative_element(&card.state.difficulties(), &selected, -1).iter() + if let Some(difficulty) = + relative_element(&card.state.difficulties(), &selected, -1) { - state.answer = Answer::Difficulty { difficulty: *d } + state.answer = Answer::Difficulty { difficulty } } } KeyCode::Right => { - for d in relative_element(&card.state.difficulties(), &selected, 1).iter() { - state.answer = Answer::Difficulty { difficulty: *d } + if let Some(difficulty) = + relative_element(&card.state.difficulties(), &selected, 1) + { + state.answer = Answer::Difficulty { difficulty } } } KeyCode::Enter => { |