Files
ottyl/tickets/095-enforce-clippy-clean.md
T
2026-09-07 12:16:36 +01:00

1.8 KiB

095 — Resolve clippy warnings and make lint enforce a clean run

Summary

make lint's backend target runs cargo clippy --all-targets with no -D warnings (or equivalent), so clippy warnings accumulate silently instead of failing the lint step. There are currently 23 unique warnings across 5 lint categories.

Where

  • Makefile:26 (lint-be:) — cargo clippy --all-targets, no denial flag.
  • cargo clippy --all-targets currently reports, by lint:
    • clippy::cloned_ref_to_slice_refs — 10 occurrences, mostly in src/engine/alerts.rs test code (e.g. around lines 469, 472, 493, 534).
    • clippy::collapsible_if — 8 occurrences, concentrated in src/engine/snapshot/mod.rs (lines 608, 940, 961) and src/engine/alerts.rs (around lines 510, 512).
    • clippy::type_complexity — 3 occurrences.
    • clippy::single_match — 1 occurrence.
    • clippy::unnecessary_get_then_check — 1 occurrence, src/engine/tests.rs:2234 (entries[1].params.get("level").is_none()).

Scope

  • Fix all 23 current warnings (mechanical for most: from_ref for the slice-ref clone cases, collapsing nested ifs, is_none() → !contains_key/get().is_none() equivalent simplification per clippy's suggestion, breaking up the complex types clippy flags or adding a type alias, converting the single-arm match to if let).
  • Once clean, change Makefile:26 to deny warnings (e.g. cargo clippy --all-targets -- -D warnings) so the target fails on any future regression instead of just printing them.
  • Don't add blanket #[allow(...)]s to silence these — fix the underlying code per clippy's suggestion, matching the existing #[allow(dead_code)] uses elsewhere in the codebase which are for genuinely-unused-for-now items, not a precedent for suppressing active lints.