From 40360c4a2a2b4daec390a1d3a0ce6659adb4c4de Mon Sep 17 00:00:00 2001 From: ".CooCoo" Date: Thu, 12 Nov 2026 16:38:53 -0800 Subject: [PATCH] Fix main: clippy on Rust 1.100 stops at shortcuts.rs and the CLI script tests (#2316) Rust 1.100 marks `ExitCode` as must-use and extends `needless_bool`, so `cargo clippy --workspace --all-targets -- -D warnings` fails on main: - `crates/ui-egui/src/shortcuts.rs`: the end of `key_event` returns the condition directly instead of `if ... { return true; } false`. - `apps/figcraft-cli/src/files.rs`: three script tests now assert the exit code that `run_script` returns (`SUCCESS` for the two scripts that run, 1 for the script whose step fails) instead of dropping it. --- apps/figcraft-cli/src/files.rs | 6 +++--- crates/ui-egui/src/shortcuts.rs | 5 +---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/apps/figcraft-cli/src/files.rs b/apps/figcraft-cli/src/files.rs index a7bddeb3b..8f277e304 100644 --- a/apps/figcraft-cli/src/files.rs +++ b/apps/figcraft-cli/src/files.rs @@ -670,7 +670,7 @@ mod tests { ) .unwrap(); let out = dir.join("out.figcraft"); - run_script(script.to_str().unwrap(), None, Some(out.to_str().unwrap())).unwrap(); + assert_eq!(run_script(script.to_str().unwrap(), None, Some(out.to_str().unwrap())).unwrap(), ExitCode::SUCCESS); let mut s = Session::empty(); s.execute("file.open", &json!({"path": out.to_str().unwrap()})).unwrap(); @@ -700,7 +700,7 @@ mod tests { ) .unwrap(); let out = dir.join("out.figcraft"); - run_script(script.to_str().unwrap(), None, Some(out.to_str().unwrap())).unwrap(); + assert_eq!(run_script(script.to_str().unwrap(), None, Some(out.to_str().unwrap())).unwrap(), ExitCode::SUCCESS); let mut s = Session::empty(); s.execute("file.open", &json!({"path": out.to_str().unwrap()})).unwrap(); @@ -737,7 +737,7 @@ mod tests { .unwrap(); let out = dir.join("out.figcraft"); // The failure is the script's, not the call's: the CLI reports it and exits non-zero. - run_script(script.to_str().unwrap(), None, Some(out.to_str().unwrap())).unwrap(); + assert_eq!(run_script(script.to_str().unwrap(), None, Some(out.to_str().unwrap())).unwrap(), ExitCode::from(1)); assert!(!out.exists(), "a script that failed writes nothing"); std::fs::remove_dir_all(dir).unwrap(); } diff --git a/crates/ui-egui/src/shortcuts.rs b/crates/ui-egui/src/shortcuts.rs index 3d312387b..1cac67b4b 100644 --- a/crates/ui-egui/src/shortcuts.rs +++ b/crates/ui-egui/src/shortcuts.rs @@ -521,10 +521,7 @@ fn key_event(app: &mut FigApp, key: Key, physical: Option, m: Modifiers, re } return true; } - if m.is_none() && !repeat && opacity_digit(app, key, now) { - return true; - } - false + m.is_none() && !repeat && opacity_digit(app, key, now) } /// Keys while a selection box drawn from the keyboard shows (`select.area`, Alt+Space or Ctrl+Space,