From 42099f84adf43cc6b67b31416619685db50ec63d Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Wed, 29 Apr 2026 17:43:57 -0500 Subject: [PATCH] fix(rust/clippy): use RangeInclusive::contains and HashMap::keys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CI runs cargo clippy with -D warnings. The yesterday's HRDPS commits introduced two pedantic-but-blocked lints: - grid.rs:97 in_conus_bbox used `>=`/`<=` chain — clippy's manual_range_contains says use (LAT_MIN..=LAT_MAX).contains(&lat). - pipeline.rs:426 backfill_dpt_from_depr iterated `cell.iter()` and threw the values away — clippy's iter_kv_map says use cell.keys().filter_map(...). Tightened the inline format strings to `{depr_key}` instead of the deprecated `{}`-with-arg form to avoid a follow-up useless_format complaint on the same touch. cargo clippy --all-targets -- -D warnings passes; cargo test --release stays at 158 passed. --- rust/prop_grid_rs/src/grid.rs | 2 +- rust/prop_grid_rs/src/pipeline.rs | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/rust/prop_grid_rs/src/grid.rs b/rust/prop_grid_rs/src/grid.rs index c1a70591..258cc4ba 100644 --- a/rust/prop_grid_rs/src/grid.rs +++ b/rust/prop_grid_rs/src/grid.rs @@ -94,7 +94,7 @@ pub fn hrdps_only_points() -> Vec<(f64, f64)> { #[inline] fn in_conus_bbox(lat: f64, lon: f64) -> bool { - lat >= LAT_MIN && lat <= LAT_MAX && lon >= LON_MIN && lon <= LON_MAX + (LAT_MIN..=LAT_MAX).contains(&lat) && (LON_MIN..=LON_MAX).contains(&lon) } /// Matches Elixir's `Float.round(x, 3)` — banker's rounding isn't used, diff --git a/rust/prop_grid_rs/src/pipeline.rs b/rust/prop_grid_rs/src/pipeline.rs index c4d3df7a..8cd1c79c 100644 --- a/rust/prop_grid_rs/src/pipeline.rs +++ b/rust/prop_grid_rs/src/pipeline.rs @@ -424,16 +424,15 @@ fn backfill_dpt_from_depr(cell: &mut CellValues) { // two passes so the iteration in pass 1 isn't invalidated by the // mutation in pass 2. let pending: Vec<(std::sync::Arc, f32)> = cell - .iter() - .filter_map(|(key, _)| { + .keys() + .filter_map(|key| { let depr_key = key.strip_prefix("DEPR:")?; - let tmp_key = format!("TMP:{}", depr_key); - let dpt_key: std::sync::Arc = format!("DPT:{}", depr_key).into(); + let tmp_key: std::sync::Arc = format!("TMP:{depr_key}").into(); + let dpt_key: std::sync::Arc = format!("DPT:{depr_key}").into(); if cell.contains_key(&dpt_key) { return None; } - let tmp_lookup: std::sync::Arc = tmp_key.into(); - let tmp = cell.get(&tmp_lookup).copied()?; + let tmp = cell.get(&tmp_key).copied()?; let depr = cell.get(key).copied()?; Some((dpt_key, tmp - depr)) })