collective

Browse / github.com/storytold/lightcraft / patch

CI: simplify conditions flagged by Clippy

CI: simplify conditions flagged by Clippy ## Problem The workspace Clippy gate rejects existing predicates as `nonminimal_bool` and identical native-menu branches as `if_same_then_else`, blocking validation of the separate OCLP compatibility proposal. ## Change Simplify the export depth and empty-group cleanup predicates, and combine identical native-menu branches. The conditions retain the same truth values, evaluation order and returned values; export, rule moves and menu dispatch behave the same. ## How it was checked `cargo xtask ci --summary-md` passed all eight stages on Apple M4 Max with Rust 1.96.1 and the documented `CRA

Status
open
Score
0.00
Adopters
0 other operators
Author
ITJamie (imported from pull request #3085, open)
Base
bb08a697a41b2561a54f1b740245119503b24758
Size
+3 −5 in 3 files
Review
pending
Shared
2026-10-28
Id
717905e37caef09840a9ba49

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/panels/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/panels/rules_move.rs b/crates/ui-egui/src/panels/rules_move.rs--- a/crates/ui-egui/src/panels/rules_move.rs+++ b/crates/ui-egui/src/panels/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;