Remove many unwrap
This commit is contained in:
1 parent
39f8845119
commit
01f0999772
5 files changed
+40
-21
No files matched your search
+10
-4
@@ -171,11 +171,17 @@ impl DictionaryQuizState {
|
||||
self.is_help = false;
|
||||
self.answer = String::new();
|
||||
|
||||
if self.current_set.is_empty() {
|
||||
self.update_set();
|
||||
}
|
||||
let next : WordData =
|
||||
match self.current_set.pop() {
|
||||
Some(word) => {
|
||||
word
|
||||
}
|
||||
None => {
|
||||
self.update_set();
|
||||
self.current_set.pop().expect("Empty set")
|
||||
}
|
||||
};
|
||||
|
||||
let next = self.current_set.pop().unwrap();
|
||||
if self.reverse {
|
||||
self.view = next.value.clone();
|
||||
self.correct = next.key.clone();
|
||||
|
||||
Reference in new issue
Block a user