1.8 KiB
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-targetscurrently reports, by lint:clippy::cloned_ref_to_slice_refs— 10 occurrences, mostly insrc/engine/alerts.rstest code (e.g. around lines 469, 472, 493, 534).clippy::collapsible_if— 8 occurrences, concentrated insrc/engine/snapshot/mod.rs(lines 608, 940, 961) andsrc/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_reffor the slice-ref clone cases, collapsing nestedifs,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-armmatchtoif let). - Once clean, change
Makefile:26to 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.