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.
This commit is contained in:
dotCooCoo committed 2026-12-02 00:19:24 -08:00
1 parent a57173accc
commit e4e77b422c
2 files changed
+11 -3

No files matched your search

+6 -1
View File
@@ -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<usize>)>;
/// 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<Data, HostError> {
// 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<usize>)>) = {
let (active, picks): (ActiveBoards, BoardPicks) = {
let moved = h.dom.active_artboards.borrow();
let shifted = h.dom.boards_shifted.borrow();
let session = h.session.borrow();
+5 -2
View File
@@ -494,7 +494,10 @@ fn layer_list(d: &Document, parent: Option<NodeId>) -> Vec<NodeId> {
/// 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<Document>, Option<NodeId>, Rc<Vec<NodeId>>, Rc<OnceCell<HashMap<NodeId, usize>>>);
pub(super) type LayerList = (u64, Arc<Document>, Option<NodeId>, Rc<Vec<NodeId>>, LayerPositions);
/// Each layer's index in a kept list, built the first time it is asked for.
pub(super) type LayerPositions = Rc<OnceCell<HashMap<NodeId, usize>>>;
/// 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<NodeId>) -> Result<Rc<V
/// The list [`layers_listed`] gives, with the index of each layer in it, which is built the first
/// time it is asked for.
fn layers_kept(h: &Host, st: &DocState, parent: Option<NodeId>) -> Result<(Rc<Vec<NodeId>>, Rc<OnceCell<HashMap<NodeId, usize>>>)> {
fn layers_kept(h: &Host, st: &DocState, parent: Option<NodeId>) -> Result<(Rc<Vec<NodeId>>, 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);