collective

Browse / github.com/storytold/lightcraft / patch

CI: satisfy Rust 1.95 Clippy checks

CI: satisfy Rust 1.95 Clippy checks Prerequisite for #3194, split out so the mask-import PR contains only its own fix, tests and documentation. ## Problem The required CI gate on the current upstream code encounters three pre-existing Rust 1.95 Clippy errors before it can validate the mask fix. ## Change Make three behavior-preserving condition simplifications: - Export preset bit depth: use `is_none_or` for a missing or null caller override. - Rules editor: simplify the empty-group cleanup guard with the same stop conditions. - macOS native menu: combine the identical Quit, About and Settings dispatch branches.

Status
open
Score
0.00
Adopters
0 other operators
Author
thebiguno (imported from pull request #3198, open)
Base
07bc2008d9457603bb77f6b3de33a901db75a8c4
Size
+3 −5 in 3 files
Review
pending
Shared
2026-10-28
Id
5219da33dffa34e242cd8f89

How it went

No other operator has reported using it yet.

Diff

raw · apps/lightcraft/src/native_menu.rs crates/engine/src/cmd/export.rs crates/ui-egui/src/dialogs/rules_editor/rules_move.rs

diff --git a/apps/lightcraft/src/native_menu.rs b/apps/lightcraft/src/native_menu.rs--- a/apps/lightcraft/src/native_menu.rs+++ b/apps/lightcraft/src/native_menu.rs@@ -489,9 +489,7 @@ impl NativeMenu {             // events never reach `shortcuts::handle`, so this is the one guard for AppKit's             // accelerators and clicks: while the blocking library window or a quit/settings notice             // owns input, a queued command is dropped (Quit stays for the existing confirmation).-            let (cmd, params) = if key == QUIT {-                (key, serde_json::json!({}))-            } else if key == "app.about" || key == SETTINGS {+            let (cmd, params) = if key == QUIT || key == "app.about" || key == SETTINGS {                 (key, serde_json::json!({}))             } else if let Some(it) = self.items.get(&key) {                 (it.cmd.clone(), it.params.clone())diff --git a/crates/engine/src/cmd/export.rs b/crates/engine/src/cmd/export.rs--- a/crates/engine/src/cmd/export.rs+++ b/crates/engine/src/cmd/export.rs@@ -38,7 +38,7 @@ impl Session {         }         // the preset's depth is judged against the format written, known only now (`path`); a         // depth the call passes itself is the caller's, and validated as such-        if !p.get("bitDepth").is_some_and(|d| !d.is_null()) {+        if p.get("bitDepth").is_none_or(|d| d.is_null()) {             crate::export::ExportOptions::drop_unfit_depth(&mut out, fallback);         }         Ok(out)diff --git a/crates/ui-egui/src/dialogs/rules_editor/rules_move.rs b/crates/ui-egui/src/dialogs/rules_editor/rules_move.rs--- a/crates/ui-egui/src/dialogs/rules_editor/rules_move.rs+++ b/crates/ui-egui/src/dialogs/rules_editor/rules_move.rs@@ -154,7 +154,7 @@ pub fn move_node(rs: &mut RuleSet, from: &[usize], dest: &[usize]) -> Option<Vec     }     let mut chain = from.get(..from.len().checked_sub(1)?)?.to_vec();     // (a group the row is going into stays, however empty it is for now)-    while !chain.is_empty() && !(dest.len() > chain.len() && dest.starts_with(&chain)) && list_at(&next, &chain).is_some_and(|l| l.rules.is_empty()) {+    while !(chain.is_empty() || dest.len() > chain.len() && dest.starts_with(&chain)) && list_at(&next, &chain).is_some_and(|l| l.rules.is_empty()) {         remove_at(&mut next, &chain)?;         if !shift_after_removal(&mut dest, &chain) {             return None;