aboutsummaryrefslogtreecommitdiff
path: root/crates/cli/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/cli/src')
-rw-r--r--crates/cli/src/run.rs2
-rw-r--r--crates/cli/src/words.rs8
2 files changed, 5 insertions, 5 deletions
diff --git a/crates/cli/src/run.rs b/crates/cli/src/run.rs
index 5d121d2..0084a6c 100644
--- a/crates/cli/src/run.rs
+++ b/crates/cli/src/run.rs
@@ -50,7 +50,7 @@ fn run_words(words: Vec<Word>, locale: &Locale) -> i32 {
let found = !answer.is_empty() && tr.split(',').any(|tr| tr.trim().contains(answer));
if found {
- if word.steps == MAX_STEPS - 1 {
+ if word.steps as usize == MAX_STEPS - 1 {
let _ = update_success(&word, word.succeeded + 1, 0);
} else {
let _ = update_success(&word, word.succeeded, word.steps + 1);
diff --git a/crates/cli/src/words.rs b/crates/cli/src/words.rs
index 60609a9..9ed16d3 100644
--- a/crates/cli/src/words.rs
+++ b/crates/cli/src/words.rs
@@ -221,7 +221,7 @@ fn ask_for_word_based_on(enunciated: String, word: Word) -> Result<Word, String>
Category::Determiner,
];
let Ok(category) = Select::new("Category:", categories)
- .with_starting_cursor(word.category as usize)
+ .with_starting_cursor((word.category as isize).try_into().unwrap())
.prompt()
else {
return Err("abort!".to_string());
@@ -237,7 +237,7 @@ fn ask_for_word_based_on(enunciated: String, word: Word) -> Result<Word, String>
let gender = match category {
Category::Noun => {
match Select::new("Gender:", genders)
- .with_starting_cursor(word.gender as usize)
+ .with_starting_cursor((word.gender as isize).try_into().unwrap())
.prompt()
{
Ok(selection) => selection,
@@ -255,7 +255,7 @@ fn ask_for_word_based_on(enunciated: String, word: Word) -> Result<Word, String>
else {
return Err("abort!".to_string());
};
- let Ok(inflection_id) = inflection.parse::<usize>() else {
+ let Ok(inflection_id) = inflection.parse::<isize>() else {
return Err(format!("bad value for inflection ID '{inflection}'"));
};
Some(inflection_id)
@@ -305,7 +305,7 @@ fn ask_for_word_based_on(enunciated: String, word: Word) -> Result<Word, String>
else {
return Err("abort!".to_string());
};
- let Ok(weight) = raw_weight.parse::<usize>() else {
+ let Ok(weight) = raw_weight.parse::<isize>() else {
return Err(format!(
"bad value for inflection ID '{}'",
inflection_id.unwrap_or(0)