From e4e77b422c3b6f910fe1312d52ba7d45fad9478a Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 2 Dec 2026 00:19:24 -0800 Subject: [PATCH] Scripts: name the artboard and layer-position types clippy flags as complex Clippy's type_complexity lint stopped the gate on the tuple types in doScript's artboard step and the kept layer list. The types get names (ActiveBoards, BoardPicks, LayerPositions); nothing else changes. --- crates/engine/src/script/actions.rs | 7 ++++++- crates/engine/src/script/dom/layers.rs | 7 +++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/script/actions.rs b/crates/engine/src/script/actions.rs index f16cb3ada2..490bb3863c 100644 --- a/crates/engine/src/script/actions.rs +++ b/crates/engine/src/script/actions.rs @@ -27,6 +27,11 @@ use vectorcraft_js::{Data, HostError, HostMember}; use super::{Host, Link, command, current, refused_to_scripts}; +/// Each open document's uid with the artboard index a run plays on. +type ActiveBoards = Vec<(u64, usize)>; +/// A document's uid with the indices of the artboards the Artboard tool holds. +type BoardPicks = Option<(u64, Vec)>; + /// The most actions a run's request may carry. pub const MAX_ACTIONS: usize = 4096; /// The most steps one action may have, after a `command.batch` step gives its own steps. @@ -258,7 +263,7 @@ fn do_script(h: &Host, a: &[Data]) -> std::result::Result { // where `artboards.add` or `artboards.insert` moved the active artboard to another index plays // on that artboard at its new index. The Artboard tool's selection is the artboards it held, // at the indices they have now. - let (active, picks): (Vec<(u64, usize)>, Option<(u64, Vec)>) = { + let (active, picks): (ActiveBoards, BoardPicks) = { let moved = h.dom.active_artboards.borrow(); let shifted = h.dom.boards_shifted.borrow(); let session = h.session.borrow(); diff --git a/crates/engine/src/script/dom/layers.rs b/crates/engine/src/script/dom/layers.rs index 04debab36a..b69fb2a6e3 100644 --- a/crates/engine/src/script/dom/layers.rs +++ b/crates/engine/src/script/dom/layers.rs @@ -494,7 +494,10 @@ fn layer_list(d: &Document, parent: Option) -> Vec { /// A document's uid, the document as it was, the parent a `Layers` object lists (`None`: the top /// level), the layers it listed then and, once a layer's place was asked for, each layer's index in /// that list. -pub(super) type LayerList = (u64, Arc, Option, Rc>, Rc>>); +pub(super) type LayerList = (u64, Arc, Option, Rc>, LayerPositions); + +/// Each layer's index in a kept list, built the first time it is asked for. +pub(super) type LayerPositions = Rc>>; /// The layers of `parent` as [`layer_list`] gives them. The last [`ART_LISTS`] lists are kept while /// their documents are unchanged, so a loop over `layers[i]` lists the layers once. Each new list @@ -505,7 +508,7 @@ fn layers_listed(h: &Host, st: &DocState, parent: Option) -> Result) -> Result<(Rc>, Rc>>)> { +fn layers_kept(h: &Host, st: &DocState, parent: Option) -> Result<(Rc>, LayerPositions)> { { let mut lists = h.dom.layers.borrow_mut(); let at = lists.iter().position(|(uid, doc, p, ..)| *uid == st.uid && Arc::ptr_eq(doc, &st.doc) && *p == parent);