From 6ea4d1f33e158407a1a0b51f210461d698513300 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Fri, 25 Jul 2025 15:58:10 +0200 Subject: Apply suggestions from clippy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- crates/cli/src/run.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'crates/cli/src/run.rs') 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, 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, 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) { } _ => { 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) { 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); } }; -- cgit v1.2.3