From 7ba3676f5fff269ddc9c3171e8336af0ddeea352 Mon Sep 17 00:00:00 2001 From: Dejan Port Date: Mon, 12 Oct 2026 02:52:07 +0200 Subject: [PATCH] fix: satisfy stricter clippy lints CI's newer stable toolchain catches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CI failed with cargo clippy --workspace --all-targets -- -D warnings, not a test. The actual cause: I'd been validating locally against rustc/clippy 1.95.0 (the toolchain this machine had installed before now), while CI installs plain "stable" (1.99.0 as of this run) — two lints new since 1.95.0 fired there and nowhere in my local checks: - clippy::int_plus_one on `src.end.row + 1 <= cap` in grid.rs, simplified to `src.end.row < cap` (same meaning, no overflow risk change: row is a u32 and cap is already saturating-clamped below MAX_ROWS - 1, so src.end.row + 1 can't wrap). - clippy::disallowed_methods on the new fill_handle_perf example's three Instant::now() calls — the project's own lint from the time- panic fix (#125 history): reading the clock traps on wasm. This example is native-only (a `cargo run --release` benchmark, never built for wasm), so it gets the same #![allow(...)] perf.rs already carries, with the same justification. Updated the local toolchain to stable (rustup update stable) and re-ran cargo clippy --workspace --all-targets -- -D warnings clean before this push, to actually match what CI checks instead of guessing again. Co-Authored-By: Claude Sonnet 5 --- crates/engine/examples/fill_handle_perf.rs | 2 ++ crates/ui-egui/src/grid.rs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/engine/examples/fill_handle_perf.rs b/crates/engine/examples/fill_handle_perf.rs index 0480c0afb..5e9ea423c 100644 --- a/crates/engine/examples/fill_handle_perf.rs +++ b/crates/engine/examples/fill_handle_perf.rs @@ -2,6 +2,8 @@ //! row-by-row `value_ref` loop from `grid.rs` vs. `Sheet::last_contiguous_nonempty`. //! `cargo run --release -p gridcraft-engine --example fill_handle_perf -- [rows]` +#![allow(clippy::disallowed_methods)] // a native-only benchmark: wasm never runs it + use std::time::Instant; use gridcraft_engine::Session; diff --git a/crates/ui-egui/src/grid.rs b/crates/ui-egui/src/grid.rs index 7ac6a848c..56fec08ee 100644 --- a/crates/ui-egui/src/grid.rs +++ b/crates/ui-egui/src/grid.rs @@ -2055,7 +2055,7 @@ fn interact(app: &mut SheetApp, ui: &mut egui::Ui, resp: &egui::Response, geo: & let src = sel.current(); let neighbour = if src.start.col > 0 { src.start.col - 1 } else { src.end.col + 1 }; let cap = src.end.row.saturating_add(1_000_000).min(MAX_ROWS - 1); - let last = if src.end.row + 1 <= cap { sh.last_contiguous_nonempty(neighbour, src.end.row + 1, cap) } else { src.end.row }; + let last = if src.end.row < cap { sh.last_contiguous_nonempty(neighbour, src.end.row + 1, cap) } else { src.end.row }; if last > src.end.row { let target = RangeRef::new(src.start, CellRef::new(last, src.end.col)); let _ = app.run("edit.autoFill", json!({"source": src.a1(), "target": target.a1()}));