Modern Apps git

← Modern-Apps.git

tile_build: fix all cargo check and clippy warnings

Commit
3b4261d150ad16ba72613cc1d17d1d1725c72e27
Author
Vayun Mathur <[email protected]>
When
2026-11-17 14:18 UTC (18 days ago)
Parents
4ac8f5d
Type aliases, MSRV-compatible idioms, checked ops, dead code removed. Verified: check/clippy --all-targets 0 warnings, tests pass.

Diff

scripts/maps/tile_build/examples/graph_cols.rs
diff --git a/scripts/maps/tile_build/examples/graph_cols.rs b/scripts/maps/tile_build/examples/graph_cols.rsindex c03fd4566c..a435ccef57 100644--- a/scripts/maps/tile_build/examples/graph_cols.rs+++ b/scripts/maps/tile_build/examples/graph_cols.rs@@ -49,7 +49,7 @@ fn main() {             rows_c.fetch_add(z19(&rows), Relaxed);             plan_c.fetch_add(z19(&planes(&rows, w)), Relaxed);             let n = rows.len() / w;-            let mut cols = Vec::with_capacity(rows.len());+            let cols;             if w == 12 {                 // lat, lon: delta from the previous node (curve-sorted); edge_ptr: delta (= degree)                 let rd = |i: usize, o: usize| i32::from_le_bytes(rows[i * 12 + o..i * 12 + o + 4].try_into().unwrap());
scripts/maps/tile_build/examples/size_lab/main.rs
diff --git a/scripts/maps/tile_build/examples/size_lab/main.rs b/scripts/maps/tile_build/examples/size_lab/main.rsindex 1fc1a2034d..5fcd2353aa 100644--- a/scripts/maps/tile_build/examples/size_lab/main.rs+++ b/scripts/maps/tile_build/examples/size_lab/main.rs@@ -747,7 +747,7 @@ fn cmd_bodies(path: &str, per_zoom: usize, out_dir: &str) {             if let Some(d) = rs_dicts[bi].as_ref() {                 let fr = zstd_rs_dict(payload, 19, d);                 acc.add("codec:zstdRS_19_dict", H + fr.len());-                if let Some(rd) = ruzstd::decoding::Dictionary::decode_dict(&dicts[bi]).ok() {+                if let Ok(rd) = ruzstd::decoding::Dictionary::decode_dict(&dicts[bi]) {                     let td = Instant::now();                     let mut dec = ruzstd::decoding::FrameDecoder::new();                     dec.add_dict(rd).expect("add dict");
scripts/maps/tile_build/examples/size_lab/more.rs
diff --git a/scripts/maps/tile_build/examples/size_lab/more.rs b/scripts/maps/tile_build/examples/size_lab/more.rsindex e6649b8284..eb6cc2561c 100644--- a/scripts/maps/tile_build/examples/size_lab/more.rs+++ b/scripts/maps/tile_build/examples/size_lab/more.rs@@ -1,5 +1,18 @@ // Included into size_lab.rs: recompress / cmp / render / dem-pyramid modes. +/// A 2D point in tile-local coordinates.+type Pt2 = (f64, f64);+/// A line segment between two [`Pt2`]s.+type Seg = (Pt2, Pt2);+/// Per-`(zoom, layer)` deviation accumulators.+type DevMap = BTreeMap<(u8, u8), DevAcc>;+/// DEM deviation stats: `(mean, max, count, raw, stored)`.+type DemStats = (f64, f64, u64, u64, u64);+/// Per-zoom [`DemStats`].+type DemMap = BTreeMap<u8, DemStats>;+/// One dem-pyramid row: `(tile id, heightmap, ancestor, saved bytes)`.+type DemRow = (u64, Option<Heightmap>, Option<(u8, u64, u64)>, i64);+ /// Every leaf entry with its first tile id, sorted by tile id (not deduplicated). struct TileIndex {     ents: Vec<(u64, u32, u64, u32)>, // (tile_id, run_length, abs offset, len)@@ -150,8 +163,7 @@ fn cmd_recompress(path: &str, out_dir: &str) {     );     out += "zoom   bodies   now_MB   raw_MB  zstdRS19  zstdRS19+dict  zstdC19  zstdC22   decode_us(now)  decode_us(zstd)\n";     let mut t = S::default();-    for z in 0..15 {-        let s = g[z];+    for (z, &s) in g.iter().enumerate() {         if s.n == 0 {             continue;         }@@ -260,7 +272,7 @@ fn seg_dist_sq_f(p: (f64, f64), a: (f64, f64), b: (f64, f64)) -> f64 {     (p.0 - qx).powi(2) + (p.1 - qy).powi(2) } -fn layer_segs_pts(l: &Layer) -> (Vec<((f64, f64), (f64, f64))>, Vec<(f64, f64)>) {+fn layer_segs_pts(l: &Layer) -> (Vec<Seg>, Vec<Pt2>) {     let mut segs = Vec::new();     let mut pts = Vec::new();     for f in &l.features {@@ -357,13 +369,13 @@ fn cmd_cmp(base: &str, cand: &str, per_zoom: usize, out_dir: &str) {         by_z.entry(z).or_default().push((id, off, len));     }     let mut sample = Vec::new();-    for (_, v) in &by_z {+    for v in by_z.values() {         let step = (v.len() / per_zoom.max(1)).max(1);         sample.extend(v.iter().step_by(step).copied());     }     let nl = a.dict.layers.len();     // key (zoom, layer) -> deviations; DEM per zoom-    let acc: Mutex<(BTreeMap<(u8, u8), DevAcc>, BTreeMap<u8, (f64, f64, u64, u64, u64)>)> = Mutex::new((BTreeMap::new(), BTreeMap::new()));+    let acc: Mutex<(DevMap, DemMap)> = Mutex::new((BTreeMap::new(), BTreeMap::new()));     let cap = 32.0;     sample.par_chunks(32).for_each(|chunk| {         let mut dev: BTreeMap<(u8, u8), DevAcc> = BTreeMap::new();@@ -790,7 +802,7 @@ fn cmd_dem_pyramid(path: &str, tol: f64, out_dir: &str) {     let mut out = format!("dem-pyramid {path} tol={tol} m\n zoom  with_dem  dropped  saved_MB(zstd19)\n");     let (mut tot_saved, mut tot_drop, mut tot_dem) = (0i64, 0u64, 0u64);     for (z, v) in &by_z {-        let res: Vec<(u64, Option<Heightmap>, Option<(u8, u64, u64)>, i64)> = v+        let res: Vec<DemRow> = v             .par_iter()             .map(|&(id, off, len)| {                 let (_, x, y) = tile_zxy(id);
scripts/maps/tile_build/examples/size_lab/p50.rs
diff --git a/scripts/maps/tile_build/examples/size_lab/p50.rs b/scripts/maps/tile_build/examples/size_lab/p50.rsindex f661de2556..472bfa1255 100644--- a/scripts/maps/tile_build/examples/size_lab/p50.rs+++ b/scripts/maps/tile_build/examples/size_lab/p50.rs@@ -16,6 +16,17 @@ use tile_build::mamaps::dict::{     LAYER_SAFETY, LAYER_TRANSIT, }; +/// A body-mutating table-drop step (see the `tables` array in `cmd_p50_layers`).+type BodyMut = fn(&mut Body);+/// A polygon edge between two tile-local points.+type EdgeKey = ((i16, i16), (i16, i16));+/// Edge-use counts keyed by [`EdgeKey`].+type EdgeMap = HashMap<EdgeKey, u32>;+/// Four byte/count totals accumulated per component.+type Count4 = (u64, u64, u64, u64);+/// Per-`(band, component)` [`Count4`] totals.+type ArcCounts = BTreeMap<(u8, String), Count4>;+ fn layer_name(id: u8) -> &'static str {     match id {         x if x == LAYER_LANDTYPE => "landtype",@@ -46,7 +57,7 @@ fn ser11(body: &Body) -> Vec<u8> { }  thread_local! {-    static CDICT: RefCell<Vec<Option<zstd::bulk::Compressor<'static>>>> = RefCell::new(Vec::new());+    static CDICT: RefCell<Vec<Option<zstd::bulk::Compressor<'static>>>> = const { RefCell::new(Vec::new()) }; }  /// zstd-19 size of `raw` against the archive's dictionary for `z`'s band (C reference encoder).@@ -107,7 +118,7 @@ fn cmd_p50_layers(path: &str, stride: usize) {             b.names = body.names.clone();             drop(format!("layer:{}", layer_name(lid)), b);         }-        let tables: [(&str, fn(&mut Body)); 7] = [+        let tables: [(&str, BodyMut); 7] = [             ("table:names", |b| {                 b.names.clear();                 for l in &mut b.layers {@@ -162,7 +173,7 @@ fn cmd_p50_layers(path: &str, stride: usize) { // ------------------------------------------------------------------ pyramid (parent overzoom)  /// Geometry of every layer of `body` mapped into child (quadrant qx,qy) coordinates.-fn quad_layer(l: &Layer, qx: u64, qy: u64, ext: f64) -> (Vec<((f64, f64), (f64, f64))>, Vec<(f64, f64)>) {+fn quad_layer(l: &Layer, qx: u64, qy: u64, ext: f64) -> (Vec<Seg>, Vec<Pt2>) {     let (segs, pts) = layer_segs_pts(l);     let ox = qx as f64 * ext / 2.0;     let oy = qy as f64 * ext / 2.0;@@ -399,7 +410,7 @@ fn cmd_p50_buildings(path: &str, stride: usize) {             }             o.push(byte | 0x80);         };-        let mut edges: HashMap<((i16, i16), (i16, i16)), u32> = HashMap::new();+        let mut edges: EdgeMap = HashMap::new();         let (mut pcx, mut pcy) = (0i64, 0i64);         for f in &l.features {             let from = f.parts_offset as usize;@@ -621,12 +632,12 @@ fn cmd_p50_arcs(path: &str, stride: usize) {     let a = open(path);     let ents = entries(&a);     let s = sample(&ents, stride, |e| e.z >= 10);-    let acc: Mutex<BTreeMap<(u8, String), (u64, u64, u64, u64)>> = Mutex::new(BTreeMap::new());+    let acc: Mutex<ArcCounts> = Mutex::new(BTreeMap::new());     s.par_iter().for_each(|e| {         let body = Body::parse(&raw_of(&a, e)).expect("parse");-        let mut local: Vec<((u8, String), (u64, u64, u64, u64))> = Vec::new();+        let mut local: Vec<((u8, String), Count4)> = Vec::new();         // all polygon edges of the tile, any layer: an edge used twice is a shared arc-        let mut edges: HashMap<((i16, i16), (i16, i16)), u32> = HashMap::new();+        let mut edges: EdgeMap = HashMap::new();         let mut rings: Vec<(u8, Vec<(i16, i16)>)> = Vec::new();         for l in &body.layers {             for f in &l.features {
scripts/maps/tile_build/src/bin/mamaps_kinds.rs
diff --git a/scripts/maps/tile_build/src/bin/mamaps_kinds.rs b/scripts/maps/tile_build/src/bin/mamaps_kinds.rsindex 2be129ce61..298ffad7bf 100644--- a/scripts/maps/tile_build/src/bin/mamaps_kinds.rs+++ b/scripts/maps/tile_build/src/bin/mamaps_kinds.rs@@ -52,7 +52,7 @@ fn read_leaf(     } else {         index::decompress_leaf(&stored, raw_len)?     };-    Ok(index::parse_leaf(&raw)?)+    index::parse_leaf(&raw) }  #[derive(Default)]
scripts/maps/tile_build/src/bin/mamaps_pack.rs
diff --git a/scripts/maps/tile_build/src/bin/mamaps_pack.rs b/scripts/maps/tile_build/src/bin/mamaps_pack.rsindex b2be61e857..6b308ce985 100644--- a/scripts/maps/tile_build/src/bin/mamaps_pack.rs+++ b/scripts/maps/tile_build/src/bin/mamaps_pack.rs@@ -1260,7 +1260,6 @@ fn main() -> ExitCode { #[cfg(test)] mod tests {     use super::*;-    use std::io::Write;     use tile_build::mamaps::archive::ArchiveView;      fn v7_tiles() -> Vec<u8> {
scripts/maps/tile_build/src/bin/mamaps_planet5.rs
diff --git a/scripts/maps/tile_build/src/bin/mamaps_planet5.rs b/scripts/maps/tile_build/src/bin/mamaps_planet5.rsindex 783f4c8531..bc7effa698 100644--- a/scripts/maps/tile_build/src/bin/mamaps_planet5.rs+++ b/scripts/maps/tile_build/src/bin/mamaps_planet5.rs@@ -55,6 +55,17 @@ fn band(z: u8) -> usize {     } } +/// A compressed body plus its content hash, shared between encoders and writers.+type ArcBody = Arc<(Vec<u8>, u64)>;+/// `(offset, band)` key of a single (non-superblock) body.+type BodyKey = (u64, usize);+/// Superblock candidate group: `(zoom, block x, block y)` key plus member indexes.+type SbGroup = ((u8, u64, u64), Vec<usize>);+/// One superblock's encode result: `(group, body, raw length)`.+type EncodedSb = Result<(u32, ArcBody, u64), String>;+/// One single body's encode result: `(key, body, raw length)`.+type EncodedBody = Result<(BodyKey, ArcBody, u64), String>;+ /// One leaf entry: first tile id, run length, absolute body offset and stored length. #[derive(Clone, Copy)] struct Ent {@@ -176,9 +187,9 @@ fn superblock_groups(ents: &[Ent]) -> Vec<Option<u32>> {         *refs.entry(e.off).or_default() += e.run as u64;     }     let mut group = vec![None; ents.len()];-    let mut cur: Option<((u8, u64, u64), Vec<usize>)> = None;+    let mut cur: Option<SbGroup> = None;     let mut next = 0u32;-    let mut close = |cur: &mut Option<((u8, u64, u64), Vec<usize>)>, group: &mut Vec<Option<u32>>| {+    let mut close = |cur: &mut Option<SbGroup>, group: &mut Vec<Option<u32>>| {         if let Some((_, members)) = cur.take() {             if members.len() >= 2 {                 for i in members {@@ -310,7 +321,7 @@ fn run(input: &str, output: &str, dict_bytes: usize, per_band: usize, verify: bo                 }             }         }-        let sb_encoded: Vec<Result<(u32, Arc<(Vec<u8>, u64)>, u64), String>> = blocks+        let sb_encoded: Vec<EncodedSb> = blocks             .par_iter()             .map_init(                 || zstd_rs::Compressor::new(cfg).expect("zstd level"),@@ -348,7 +359,7 @@ fn run(input: &str, output: &str, dict_bytes: usize, per_band: usize, verify: bo                 },             )             .collect();-        let mut by_group: HashMap<u32, Arc<(Vec<u8>, u64)>> = HashMap::with_capacity(sb_encoded.len());+        let mut by_group: HashMap<u32, ArcBody> = HashMap::with_capacity(sb_encoded.len());         for r in sb_encoded {             let (g, v, raw) = r?;             raw_in += raw;@@ -366,7 +377,7 @@ fn run(input: &str, output: &str, dict_bytes: usize, per_band: usize, verify: bo             .collect();         keys.sort_unstable();         keys.dedup();-        let encoded: Vec<Result<((u64, usize), Arc<(Vec<u8>, u64)>, u64), String>> = keys+        let encoded: Vec<EncodedBody> = keys             .par_iter()             .map_init(                 || zstd_rs::Compressor::new(cfg).expect("zstd level"),@@ -392,7 +403,7 @@ fn run(input: &str, output: &str, dict_bytes: usize, per_band: usize, verify: bo                 },             )             .collect();-        let mut by_key: HashMap<(u64, usize), Arc<(Vec<u8>, u64)>> = HashMap::with_capacity(encoded.len());+        let mut by_key: HashMap<BodyKey, ArcBody> = HashMap::with_capacity(encoded.len());         for r in encoded {             let (k, v, raw) = r?;             raw_in += raw;
scripts/maps/tile_build/src/bin/mamaps_probe.rs
diff --git a/scripts/maps/tile_build/src/bin/mamaps_probe.rs b/scripts/maps/tile_build/src/bin/mamaps_probe.rsindex a608efd504..29ea897af7 100644--- a/scripts/maps/tile_build/src/bin/mamaps_probe.rs+++ b/scripts/maps/tile_build/src/bin/mamaps_probe.rs@@ -329,7 +329,6 @@ fn breakdown(path: &str, samples_per_zoom: usize) -> ExitCode {         let mut raw_body = 0u64;         let mut raw_dem = 0u64;         let mut stored_dem = 0u64;-        let mut stored_nodem = 0u64;         let mut idx = 0usize;         while idx < zoom.entries.len() {             let (at, len) = zoom.entries[idx];@@ -360,8 +359,6 @@ fn breakdown(path: &str, samples_per_zoom: usize) -> ExitCode {                 with_dem += 1;                 raw_dem += (2 + hm.samples.len() * 2) as u64;                 stored_dem += len as u64;-            } else {-                stored_nodem += len as u64;             }             idx += step;         }@@ -372,10 +369,7 @@ fn breakdown(path: &str, samples_per_zoom: usize) -> ExitCode {         // the zoom's body count. DEFLATE-compressibility differs between the two         // populations, so this is measured, not modelled.         let dem_bodies = zoom.bodies as f64 * with_dem as f64 / sampled as f64;-        let nodem_bodies = zoom.bodies as f64 - dem_bodies;-        let avg_stored_dem = if with_dem > 0 { stored_dem / with_dem } else { 0 };-        let avg_stored_nodem =-            if sampled > with_dem { stored_nodem / (sampled - with_dem) } else { 0 };+        let avg_stored_dem = stored_dem.checked_div(with_dem).unwrap_or(0);         let stored_dem_total = dem_bodies * avg_stored_dem as f64;         println!(             "z{z:<3} {:>7} {:>8} {:>8.1}% {:>11} {:>10} {:>8.1}% {:>10} {:>6.1}%",@@ -383,11 +377,9 @@ fn breakdown(path: &str, samples_per_zoom: usize) -> ExitCode {             with_dem,             100.0 * with_dem as f64 / sampled as f64,             fmt_bytes(raw_body / sampled),-            if with_dem > 0 {-                fmt_bytes(raw_dem / with_dem).to_string()-            } else {-                "-".to_string()-            },+            raw_dem+                .checked_div(with_dem)+                .map_or_else(|| "-".to_string(), |v| fmt_bytes(v).to_string()),             100.0 * raw_dem as f64 / raw_body.max(1) as f64,             fmt_bytes(stored_dem_total as u64),             100.0 * stored_dem_total / zoom.stored.max(1) as f64,
scripts/maps/tile_build/src/bin/mamaps_sizes.rs
diff --git a/scripts/maps/tile_build/src/bin/mamaps_sizes.rs b/scripts/maps/tile_build/src/bin/mamaps_sizes.rsindex b1f1821418..0ee479b110 100644--- a/scripts/maps/tile_build/src/bin/mamaps_sizes.rs+++ b/scripts/maps/tile_build/src/bin/mamaps_sizes.rs@@ -22,9 +22,7 @@ use std::collections::BTreeMap; use std::process::ExitCode;  use tile_build::mamaps::body::{-    BODY_FLAG_BUILDING_TABLE, BODY_FLAG_EXTENDED_COUNTS, BODY_FLAG_HEIGHTMAP,-    BODY_FLAG_ID_TABLE, BODY_FLAG_LANE_TABLE, BODY_FLAG_NAME_TABLE, BODY_FLAG_ROAD_LANES,-    BODY_HEADER_LEN, FEATURE_RECORD_LEN, LAYER_INDEX_LEN,+    BODY_FLAG_EXTENDED_COUNTS, BODY_HEADER_LEN, LAYER_INDEX_LEN, }; use tile_build::mamaps::dict::Dictionary; use tile_build::mamaps::header::Header;@@ -412,21 +410,8 @@ fn run(path: &str, sample_every_arg: u64) -> Result<(), String> {     f.read_exact(&mut root_buf).map_err(|e| format!("cannot read root: {e}"))?;     let root = parse_root(&root_buf).map_err(|e| format!("bad root: {e:?}"))?; -    let mut layer_stored: BTreeMap<u8, u64> = BTreeMap::new();-    let mut layer_raw: BTreeMap<u8, u64> = BTreeMap::new();-    let mut layer_bodies: BTreeMap<u8, u64> = BTreeMap::new();-    let mut layer_features: BTreeMap<u8, u64> = BTreeMap::new();-    let mut flags_hist: BTreeMap<u8, u64> = BTreeMap::new();-    let mut extended_count = 0u64;-    let mut total_stored = 0u64;-    let mut total_raw = 0u64;-    let mut empty_bodies = 0u64;-    let mut empty_stored = 0u64;-    let mut bodies_seen = 0u64;--    // `layer_names` was built from the file's dict above; the dead first-pass-    // accumulators used to live here but were shadowed by the aggregation block-    // below, so they are gone and only the dict-derived names survive.+    // `layer_names` was built from the file's dict above; the aggregation+    // accumulators live in the block below that folds the per-leaf partials.      let t0 = std::time::Instant::now();     // Parallel scan: one task per root entry (313 leaves for this archive), each
scripts/maps/tile_build/src/bin/transit_planet5.rs
diff --git a/scripts/maps/tile_build/src/bin/transit_planet5.rs b/scripts/maps/tile_build/src/bin/transit_planet5.rsindex ef1f1595a6..7c212f9e2e 100644--- a/scripts/maps/tile_build/src/bin/transit_planet5.rs+++ b/scripts/maps/tile_build/src/bin/transit_planet5.rs@@ -25,7 +25,6 @@ use std::process::ExitCode; const HEADER_LEN: usize = 80; const DEVICE_SECTIONS: usize = 27; const SEC_ROUTES: usize = 2;-const SEC_ROUTE_STOPS: usize = 3; const SEC_ROUTE_TRIPS: usize = 4; const SEC_SHAPE_COORDS: usize = 20; const SEC_ROUTE_SHAPE_IDX: usize = 21;@@ -40,7 +39,7 @@ const ROUTE_REC: usize = 32; ///   cold only           2.94 GB  1.01x (60 queries)  <- default ///   cold + exceptions   2.45 GB  1.30x (12 queries), 5.5x (60: long searches thrash the cache) ///   + stop routes 2.3x | + transfers 2.6x | + profiles 5.2x (12 queries)-///   everything          1.19 GB  ~35x+///     everything          1.19 GB  ~35x const COLD_SECTIONS: [usize; 8] = [0, 16, 17, 20, 21, 22, 23, 24]; const NONE: u32 = u32::MAX; 
scripts/maps/tile_build/src/boolean_part2.rs
diff --git a/scripts/maps/tile_build/src/boolean_part2.rs b/scripts/maps/tile_build/src/boolean_part2.rsindex 1e32217e79..0e6b246d9f 100644--- a/scripts/maps/tile_build/src/boolean_part2.rs+++ b/scripts/maps/tile_build/src/boolean_part2.rs@@ -20,18 +20,18 @@ fn assemble(rings: Vec<Vec<Pt>>) -> Vec<Polygon> {     let mut index_of: Vec<Option<usize>> = vec![None; rings.len()];     // Even depth is an exterior, odd is a hole in the nearest enclosing exterior.     for i in 0..rings.len() {-        if depth[i].is_multiple_of(2) {+        if depth[i] % 2 == 0 {             index_of[i] = Some(out.len());             out.push(vec![orient(rings[i].clone(), true)]);         }     }     for i in 0..rings.len() {-        if !depth[i].is_multiple_of(2) {+        if depth[i] % 2 != 0 {             // The enclosing exterior is the deepest even-depth ring that contains it.             let mut best: Option<(usize, usize)> = None;             let probe = rings[i][0];             for j in 0..rings.len() {-                if i == j || !depth[j].is_multiple_of(2) {+                if i == j || depth[j] % 2 != 0 {                     continue;                 }                 if point_in_ring(probe, &rings[j]) && best.is_none_or(|(d, _)| depth[j] >= d) {
scripts/maps/tile_build/src/progress.rs
diff --git a/scripts/maps/tile_build/src/progress.rs b/scripts/maps/tile_build/src/progress.rsindex ed286dbff8..6b2a2ab391 100644--- a/scripts/maps/tile_build/src/progress.rs+++ b/scripts/maps/tile_build/src/progress.rs@@ -93,11 +93,9 @@ impl Progress {      fn draw(&self, unit: &str) {         let elapsed = self.start.elapsed().as_secs_f64();-        let pct = if self.total == 0 {-            100-        } else {-            (self.done * 100 / self.total).min(100)-        };+        let pct = (self.done * 100)+            .checked_div(self.total)+            .map_or(100, |p| p.min(100));         // ETA extrapolates the average rate so far; meaningless until something is         // done, so hold it at zero for the opening frame.         let eta = if self.done == 0 {
scripts/maps/tile_build/src/spill.rs
diff --git a/scripts/maps/tile_build/src/spill.rs b/scripts/maps/tile_build/src/spill.rsindex 52d9c5515c..3c7f5ddee5 100644--- a/scripts/maps/tile_build/src/spill.rs+++ b/scripts/maps/tile_build/src/spill.rs@@ -74,6 +74,10 @@ pub const REC_HEADER_BYTES: usize = 48; /// Bytes of fixed header before a normalized record's two variable payloads. pub const NORM_HEADER_BYTES: usize = 16; +/// Property predicate for [`NormalizedChunks::read_into_where`]: keep a feature+/// whose `(key, value)` properties satisfy it.+type KeepProps = dyn Fn(&[(String, Value)]) -> bool;+ /// Features per entry in the normalized file's chunk index. /// /// The index is what lets the bucket pass read the normalized file across the pool
scripts/maps/tile_build/src/spill_part1.rs
diff --git a/scripts/maps/tile_build/src/spill_part1.rs b/scripts/maps/tile_build/src/spill_part1.rsindex 3a22d08724..6b5e8192ae 100644--- a/scripts/maps/tile_build/src/spill_part1.rs+++ b/scripts/maps/tile_build/src/spill_part1.rs@@ -219,7 +219,7 @@ impl BucketSet {         if want_buckets == 0 {             return err("bucket set needs at least one bucket");         }-        if !want_buckets.is_power_of_two() || !want_buckets.trailing_zeros().is_multiple_of(2) {+        if !want_buckets.is_power_of_two() || want_buckets.trailing_zeros() % 2 != 0 {             return err(format!(                 "bucket count must be a power of four so a bucket is one quadtree cell, got \                  {want_buckets}"
scripts/maps/tile_build/src/spill_part2.rs
diff --git a/scripts/maps/tile_build/src/spill_part2.rs b/scripts/maps/tile_build/src/spill_part2.rsindex 37dd79401c..803bdc4e10 100644--- a/scripts/maps/tile_build/src/spill_part2.rs+++ b/scripts/maps/tile_build/src/spill_part2.rs@@ -1146,7 +1146,7 @@ impl NormalizedChunks {         i: usize,         scratch: &mut Vec<u8>,         out: &mut Vec<NormalizedFeature>,-        keep: &dyn Fn(&[(String, Value)]) -> bool,+        keep: &KeepProps,     ) -> Result<()> {         out.clear();         let mut all = Vec::new();
scripts/maps/tile_build/src/subdivide.rs
diff --git a/scripts/maps/tile_build/src/subdivide.rs b/scripts/maps/tile_build/src/subdivide.rsindex 87eccb7271..f6b1ce3ea0 100644--- a/scripts/maps/tile_build/src/subdivide.rs+++ b/scripts/maps/tile_build/src/subdivide.rs@@ -384,7 +384,7 @@ where             }             Geometry::Lines(out)         }-        Geometry::Polygons(polys) => {+        Geometry::Polygons(_) => {             // Rings need the clip's own normalisation (explicit-close             // handling and consecutive-duplicate dedup interact with             // filtering in ways a hand replica would get subtly wrong), and
scripts/maps/tile_build/src/timing.rs
diff --git a/scripts/maps/tile_build/src/timing.rs b/scripts/maps/tile_build/src/timing.rsindex 408b66a03e..d1e0525f10 100644--- a/scripts/maps/tile_build/src/timing.rs+++ b/scripts/maps/tile_build/src/timing.rs@@ -104,7 +104,7 @@ impl PhaseTimer {      fn close_current(&mut self) {         let secs = self.current_start.elapsed().as_secs_f64();-        let name = std::mem::replace(&mut self.current, String::new());+        let name = std::mem::take(&mut self.current);         self.segments.push((name, secs));     } }
scripts/maps/tile_build/tests/churn_phase0.rs
diff --git a/scripts/maps/tile_build/tests/churn_phase0.rs b/scripts/maps/tile_build/tests/churn_phase0.rsindex cb20340a7c..bafe8a6b98 100644--- a/scripts/maps/tile_build/tests/churn_phase0.rs+++ b/scripts/maps/tile_build/tests/churn_phase0.rs@@ -125,7 +125,6 @@ mod tests {     fn added_and_deleted_tiles_report_by_tile_not_entry() {         let grown = ids(3, 12);         let base = grown[..8].to_vec();-        let grown = grown;         let (before, _) = archive(&base, 0);         let (after, _) = archive(&grown, 0);         let report = join(&snap(&before), &snap(&after));
scripts/maps/tile_build/tests/clip_part1.rs
diff --git a/scripts/maps/tile_build/tests/clip_part1.rs b/scripts/maps/tile_build/tests/clip_part1.rsindex 7bff2dee21..6c1f06de48 100644--- a/scripts/maps/tile_build/tests/clip_part1.rs+++ b/scripts/maps/tile_build/tests/clip_part1.rs@@ -268,7 +268,7 @@ mod tests {         // invariant stage C's strictly_inside demands before the boundary rule.         for &(x, y) in &out[1] {             assert!(-                x >= 0.0 && x <= 10.0 && y >= 2.0 && y <= 8.0,+                (0.0..=10.0).contains(&x) && (2.0..=8.0).contains(&y),                 "hole vertex ({x}, {y}) escaped the clipped exterior"             );         }
scripts/maps/tile_build/tests/simplify_extra.rs
diff --git a/scripts/maps/tile_build/tests/simplify_extra.rs b/scripts/maps/tile_build/tests/simplify_extra.rsindex db7601c985..eb440014c7 100644--- a/scripts/maps/tile_build/tests/simplify_extra.rs+++ b/scripts/maps/tile_build/tests/simplify_extra.rs@@ -352,8 +352,8 @@ mod tests {         use tile_build::geom::Rect;         // A land edge and a water edge sharing the segment x=0..20 at y=0.         let rect = Rect { min_x: 0.0, min_y: -10.0, max_x: 20.0, max_y: 10.0 };-        let land = vec![(0.0, -10.0), (20.0, -10.0), (20.0, 0.0), (0.0, 0.0), (0.0, -10.0)];-        let water = vec![(0.0, 10.0), (20.0, 10.0), (20.0, 0.0), (0.0, 0.0), (0.0, 10.0)];+        let land = [(0.0, -10.0), (20.0, -10.0), (20.0, 0.0), (0.0, 0.0), (0.0, -10.0)];+        let water = [(0.0, 10.0), (20.0, 10.0), (20.0, 0.0), (0.0, 0.0), (0.0, 10.0)];         let land_ring: Vec<SigPt> =             clip_ring(&land.iter().map(|&(x, y)| SigPt::new(x, y)).collect::<Vec<_>>(), &rect);         let water_ring: Vec<SigPt> =