diff options
| author | Miquel Sabaté Solà <mikisabate@gmail.com> | 2025-07-25 15:58:10 +0200 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2025-07-25 15:58:10 +0200 |
| commit | 6ea4d1f33e158407a1a0b51f210461d698513300 (patch) | |
| tree | 8e3d82008d2b28f7a17c9719787e24813c7af4ff /crates/cli/src/run.rs | |
| parent | 9310bf5d60810c1f911a41cccfeef3c8563211ef (diff) | |
| download | mihi-6ea4d1f33e158407a1a0b51f210461d698513300.tar.gz mihi-6ea4d1f33e158407a1a0b51f210461d698513300.zip | |
Apply suggestions from clippy
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'crates/cli/src/run.rs')
| -rw-r--r-- | crates/cli/src/run.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/cli/src/run.rs b/crates/cli/src/run.rs index 0cce6d6..31c521d 100644 --- a/crates/cli/src/run.rs +++ b/crates/cli/src/run.rs @@ -51,13 +51,13 @@ fn run_words(words: Vec<Word>, locale: Locale) -> i32 { println!("Word: {}", word.enunciated); - let Ok(raw) = Text::new(format!("Translation ({}):", locale).as_str()).prompt() else { + let Ok(raw) = Text::new(format!("Translation ({locale}):").as_str()).prompt() else { return 1; }; let answer = raw.trim(); let tr = translation.as_str().unwrap_or(""); - let found = !answer.is_empty() && tr.split(',').any(|tr| tr.trim().contains(&answer)); + let found = !answer.is_empty() && tr.split(',').any(|tr| tr.trim().contains(answer)); if found { if word.steps == MAX_STEPS - 1 { @@ -65,12 +65,12 @@ fn run_words(words: Vec<Word>, locale: Locale) -> i32 { } else { let _ = update_success(&word, word.succeeded, word.steps + 1); } - println!("\x1b[92m✓ {}\x1b[0m", tr); + println!("\x1b[92m✓ {tr}\x1b[0m"); } else { if word.succeeded > 0 { let _ = update_success(&word, word.succeeded - 1, 0); } - println!("\x1b[91m❌{}\x1b[0m", tr); + println!("\x1b[91m❌{tr}\x1b[0m"); errors += 1; } } @@ -122,7 +122,7 @@ pub fn run(args: Vec<String>) { } _ => { help(Some( - format!("error: run: unknown flag or command '{}'", first).as_str(), + format!("error: run: unknown flag or command '{first}'").as_str(), )); std::process::exit(1); } @@ -144,7 +144,7 @@ pub fn run(args: Vec<String>) { match words { Ok(list) => std::process::exit(run_words(list, locale)), Err(e) => { - println!("error: run: {}", e); + println!("error: run: {e}"); std::process::exit(1); } }; |
