aboutsummaryrefslogtreecommitdiff
path: root/src/gui/question.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/question.rs')
-rw-r--r--src/gui/question.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gui/question.rs b/src/gui/question.rs
index 71c3ea2..2aa6e65 100644
--- a/src/gui/question.rs
+++ b/src/gui/question.rs
@@ -1,6 +1,6 @@
use crate::{
gui::util,
- model::{card::Card, difficulty, difficulty::Difficulty},
+ model::{difficulty, difficulty::Difficulty, Card},
util::event::{Event, Events},
util::serialization,
};
@@ -150,7 +150,9 @@ pub fn ask<B: Backend>(
Key::Char(c) => {
state.input.push(c);
if is_correct(&state.input, &card.responses) {
- state.answer = Answer::Difficulty { difficulty: Difficulty::Good }
+ state.answer = Answer::Difficulty {
+ difficulty: Difficulty::Good,
+ }
}
}
Key::Backspace => {
@@ -161,12 +163,12 @@ pub fn ask<B: Backend>(
}
Key::Ctrl('w') => {
let mut words = state.input.split_whitespace().collect::<Vec<&str>>();
- if words.len() > 0 {
+ if !words.is_empty() {
words.truncate(words.len() - 1);
state.input = format!(
"{}{}",
words.join(" "),
- if words.len() > 0 { " " } else { "" }
+ if !words.is_empty() { " " } else { "" }
);
}
}