From 00f565bc11d69623f5260a13e143c20c65d0c85f Mon Sep 17 00:00:00 2001 From: vangel76 Date: Mon, 2 Nov 2026 19:44:16 +0100 Subject: [PATCH] Factor out types clippy flags as too complex Co-Authored-By: Claude Sonnet 5.5 --- crates/calc/src/recalc/pass_host.rs | 5 ++++- crates/calc/src/tests.rs | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/calc/src/recalc/pass_host.rs b/crates/calc/src/recalc/pass_host.rs index 6151b74d3..9964b3363 100644 --- a/crates/calc/src/recalc/pass_host.rs +++ b/crates/calc/src/recalc/pass_host.rs @@ -13,6 +13,9 @@ const MAX_NESTED: usize = 64; /// evaluated again), however high Maximum Iterations is. const MAX_ITERATION_WORK: usize = 10_000_000; +/// A block's results by last row: its sum and count, or `None` when it can't be summed from constants. +type BlockSums = std::collections::BTreeMap>; + pub(super) struct PassHost<'a> { wb: &'a Workbook, exprs: &'a HashMap>, @@ -71,7 +74,7 @@ pub(super) struct PassHost<'a> { /// Sum and count of blocks that hold only constants, for `range_sum`. Keyed by sheet, first /// cell and last column; each value maps a last row to the block's result (`None`: the block /// has a formula, a Python cell, an error value or a spilled value, so every longer one has too). - sums: HashMap<(usize, CellRef, u32), std::collections::BTreeMap>>, + sums: HashMap<(usize, CellRef, u32), BlockSums>, /// The kept results of the Python cells in the pass: a Python cell isn't evaluated, its /// result is laid out (an array spills from the cell, as a formula's does). Each one is in /// `pending` until it is laid out, so a formula that reads it first gets its new value. diff --git a/crates/calc/src/tests.rs b/crates/calc/src/tests.rs index a55231794..0c9ec4aa1 100644 --- a/crates/calc/src/tests.rs +++ b/crates/calc/src/tests.rs @@ -2348,7 +2348,8 @@ fn aggregates_over_ranges_match_a_plain_fold_bit_for_bit() { } } // Formulas in column H and up: (function, optional leading number, blocks). - let mut oracle: Vec<(CellRef, &str, Option, Vec<(u32, u32, u32, u32)>)> = vec![]; + type Oracle<'a> = (CellRef, &'a str, Option, Vec<(u32, u32, u32, u32)>); + let mut oracle: Vec = vec![]; let funcs = ["SUM", "COUNT", "AVERAGE"]; let mut at = 0; let mut add = |wb: &mut Workbook, f: &'static str, lead: Option, blocks: Vec<(u32, u32, u32, u32)>| {