From 885b7acac1d3d013588c421ef30d31724bbf6a34 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Mon, 5 Oct 2026 23:05:32 +0700 Subject: [PATCH] Fix #87: rust-version is 1.95, and clippy 1.95 passes egui 0.36 needs rustc 1.95 (hayro and krilla 1.92), so the declared 1.90 let cargo fail on dependency versions instead of naming the toolchain. Clippy 1.95 also flagged four collapsible matches that newer clippy no longer does; each is rewritten without changing behaviour. Co-Authored-By: Claude Opus 5.5 --- Cargo.toml | 2 +- crates/engine/src/cmd/pathops.rs | 6 +----- crates/ui-egui/src/dialogs/new_document.rs | 4 +++- crates/ui-egui/src/menus.rs | 9 ++++----- xtask/src/layers.rs | 8 ++++---- 5 files changed, 13 insertions(+), 16 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4450c0787..174eca7eb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ default-members = ["crates/*", "apps/vectorcraft", "apps/vectorcraft-cli", "xtas version = "0.3.0" edition = "2024" license = "MIT OR Apache-2.0" -rust-version = "1.90" +rust-version = "1.95" repository = "https://github.com/storytold/vectorcraft" [workspace.dependencies] diff --git a/crates/engine/src/cmd/pathops.rs b/crates/engine/src/cmd/pathops.rs index a060826be..adf6afe73 100644 --- a/crates/engine/src/cmd/pathops.rs +++ b/crates/engine/src/cmd/pathops.rs @@ -757,11 +757,7 @@ fn clean_up(s: &mut Session, p: &Value) -> Result { visit(c, true, false, false, v, opts); } } - NodeKind::Text(t) => { - if empty_text && t.plain_text().trim().is_empty() { - v.push(n.id); - } - } + NodeKind::Text(t) if empty_text && t.plain_text().trim().is_empty() => v.push(n.id), NodeKind::Layer { children, .. } => { for c in children { visit(c, false, false, false, v, opts); diff --git a/crates/ui-egui/src/dialogs/new_document.rs b/crates/ui-egui/src/dialogs/new_document.rs index 441f24809..47150f0ae 100644 --- a/crates/ui-egui/src/dialogs/new_document.rs +++ b/crates/ui-egui/src/dialogs/new_document.rs @@ -97,7 +97,9 @@ fn sync(app: &VectorcraftApp, d: &mut Dialog) { let preset = d.str("preset"); match d.fields.get(APPLIED).and_then(Value::as_object) { Some(a) if a.get("preset").and_then(Value::as_str) == Some(preset.as_str()) => { - if a.iter().any(|(k, v)| k != "preset" && d.fields.get(k) != Some(v)) { + // Unchanged fields keep the preset (falling through would apply it again). + let edited = a.iter().any(|(k, v)| k != "preset" && d.fields.get(k) != Some(v)); + if edited { d.fields.insert("preset".into(), json!("")); d.fields.remove(APPLIED); } diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rs index 81341c9e3..3477c2e9a 100644 --- a/crates/ui-egui/src/menus.rs +++ b/crates/ui-egui/src/menus.rs @@ -2383,14 +2383,13 @@ mod tests { fn walk(items: &[Item], bad: &mut Vec) { for it in items { match it { - Item::Cmd(_, id, _) => { + Item::Cmd(_, id, _) if vectorcraft_engine::find_command(id).is_none() && !UI_COMMANDS.iter().any(|c| c.0 == *id) && !id.starts_with("object.path.") - && *id != "type.createOutlines" - { - bad.push(id.to_string()); - } + && *id != "type.createOutlines" => + { + bad.push(id.to_string()); } Item::Sub(_, ch) => walk(ch, bad), _ => {} diff --git a/xtask/src/layers.rs b/xtask/src/layers.rs index 7f9359056..5bfa0c1cb 100644 --- a/xtask/src/layers.rs +++ b/xtask/src/layers.rs @@ -177,11 +177,11 @@ pub fn check(crates: &[Crate]) -> Vec { match classify(&d.name) { // Unregistered deps are reported on their own entry. None => {} - Some(Class::Testkit) => { - if d.kind != DepKind::Dev { - out.push(Violation::TestkitAsNormalDep { krate: c.name.clone() }); - } + Some(Class::Testkit) if d.kind != DepKind::Dev => { + out.push(Violation::TestkitAsNormalDep { krate: c.name.clone() }); } + // The testkit as a dev-dependency is how tests use it. + Some(Class::Testkit) => {} Some(dc) => { let to = dc.layer().unwrap_or(u8::MAX); if to >= layer && !(to == layer && intra_layer_allowed(&c.name, &d.name)) {