maps: clippy hygiene in graph coverage tests
- Commit
e4c41b0b11b5189fce9c6f2433ab584e37addf47- Author
- Vayun Mathur <[email protected]>
- When
- 2026-12-01 21:58 UTC (4 days ago)
- Parents
fe560c6
Workspace clippy flagged: an index loop writing rank slots (now enumerate over the taken prefix, same bounds) and two map_or(false, ..) checks on v9 name offsets (now is_some_and with the same payload predicates). Left standing: a type_complexity note on a test-local edge-list annotation; naming a one-use test type adds indirection without clarity. Verified: cargo clippy -p offlinerouter --all-targets shows only that item, cargo test -p offlinerouter (126+2 passed), fmt clean.
Diff
maps/src/main/rust/src/graph/graph_cov_tests.rs
diff --git a/maps/src/main/rust/src/graph/graph_cov_tests.rs b/maps/src/main/rust/src/graph/graph_cov_tests.rsindex 038373fd2e..c3d70a4fea 100644--- a/maps/src/main/rust/src/graph/graph_cov_tests.rs+++ b/maps/src/main/rust/src/graph/graph_cov_tests.rs@@ -29,8 +29,8 @@ fn bitmap(edge_count: u64, present: &[u64]) -> Vec<u8> { bytes[(i / 8) as usize] |= 1 << (i % 8); } let mut run = 0u64;- for b in 0..blocks as usize {- rank[b] = run;+ for (b, slot) in rank.iter_mut().enumerate().take(blocks as usize) {+ *slot = run; let (lo, hi) = (b * RANK_BLOCK_BYTES as usize, ((b + 1) * RANK_BLOCK_BYTES as usize).min(bytes.len())); run += bytes[lo..hi].iter().map(|x| u64::from(x.count_ones())).sum::<u64>();@@ -377,12 +377,12 @@ fn zsec_regions_round_trip_reads_and_cstrings() { assert!(z2.is_some() && raw_len == raw.len()); assert!(matches!(ZsecRegion::v9_names(std::ptr::null(), 0, true), Some((None, 0)))); let table = tilecodec::zsec::write_zsec(&8u32.to_le_bytes().repeat(2), 1024, 3);- assert!(ZsecRegion::v9_name_offsets(&table, 0, 2, true).map_or(false, |z| z.is_some()));+ assert!(ZsecRegion::v9_name_offsets(&table, 0, 2, true).is_some_and(|z| z.is_some())); assert!( ZsecRegion::v9_name_offsets(&table, 0, 3, true).is_none(), "raw length must match named*4" );- assert!(ZsecRegion::v9_name_offsets(&[0u8; 8], 0, 2, false).map_or(false, |z| z.is_none()));+ assert!(ZsecRegion::v9_name_offsets(&[0u8; 8], 0, 2, false).is_some_and(|z| z.is_none())); assert!(ZsecRegion::v9_name_offsets(&[0u8; 7], 0, 2, false).is_none()); }