fix(rust/clippy): use RangeInclusive::contains and HashMap::keys

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.
This commit is contained in:
Graham McIntire 2026-04-29 17:43:57 -05:00
parent 3607a915ba
commit 42099f84ad
No known key found for this signature in database
GPG key ID: F4ABF488E6029E59
2 changed files with 6 additions and 7 deletions

View file

@ -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,

View file

@ -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<str>, 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<str> = format!("DPT:{}", depr_key).into();
let tmp_key: std::sync::Arc<str> = format!("TMP:{depr_key}").into();
let dpt_key: std::sync::Arc<str> = format!("DPT:{depr_key}").into();
if cell.contains_key(&dpt_key) {
return None;
}
let tmp_lookup: std::sync::Arc<str> = 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))
})