Modern Apps git

← Modern-Apps.git

osm_ingest: fix all cargo check and clippy warnings

Commit
e27eef7d2264c7c63c909d8733b384d747a2bf24
Author
Vayun Mathur <[email protected]>
When
2026-11-17 14:18 UTC (18 days ago)
Parents
4d49d92
Params structs (PassSpec, poi Paths) for too_many_arguments, type aliases for type_complexity, MSRV-compatible idioms, dead/test-only code gated or removed. Verified: cargo check/clippy --all-targets 0 warnings, cargo test 315 passed.

Diff

scripts/maps/osm_ingest/src/bin/poi_extract.rs
diff --git a/scripts/maps/osm_ingest/src/bin/poi_extract.rs b/scripts/maps/osm_ingest/src/bin/poi_extract.rsindex 2e652fb5f0..18b088e89f 100644--- a/scripts/maps/osm_ingest/src/bin/poi_extract.rs+++ b/scripts/maps/osm_ingest/src/bin/poi_extract.rs@@ -37,32 +37,24 @@ fn main() -> ExitCode {         println!("Loaded {} review row(s)", table.len());     }; +    let paths = osm_ingest::poi_build::Paths {+        input: &args.input,+        geojson: &args.geojson,+        names: &args.names,+        index: &args.index,+        attrs: &args.attrs,+        spatial: &args.spatial,+        name_index: &args.name_index,+        region: &args.region,+    };     let result = match loader {         Some(loader) => osm_ingest::poi_build::build_with_review_loader(-            &args.input,-            &args.geojson,-            &args.names,-            &args.index,-            &args.attrs,-            &args.spatial,-            &args.name_index,-            &args.region,+            paths,             args.bbox,             loader,             &on_loaded,         ),-        None => osm_ingest::poi_build::build_with_reviews(-            &args.input,-            &args.geojson,-            &args.names,-            &args.index,-            &args.attrs,-            &args.spatial,-            &args.name_index,-            &args.region,-            args.bbox,-            None,-        ),+        None => osm_ingest::poi_build::build_with_reviews(paths, args.bbox, None),     };     match result {         Ok(stats) => {
scripts/maps/osm_ingest/src/chains.rs
diff --git a/scripts/maps/osm_ingest/src/chains.rs b/scripts/maps/osm_ingest/src/chains.rsindex 88c7afa295..3efd345c2d 100644--- a/scripts/maps/osm_ingest/src/chains.rs+++ b/scripts/maps/osm_ingest/src/chains.rs@@ -42,7 +42,7 @@ //! Both of those were bugs that had to be fixed once already.  use std::fs::File;-use std::io::{BufReader, BufWriter, Read, Write};+use std::io::{BufWriter, Write}; use std::path::{Path, PathBuf};  use crate::compact::Chain;@@ -132,9 +132,7 @@ pub(crate) fn count_degrees(         let _ = pbf::run_pass_sink(             input,             blobs,-            Some(blob_kinds),-            KIND_WAYS,-            "Pass 3: node degrees",+            pbf::PassSpec { blob_kinds: Some(blob_kinds), want: KIND_WAYS, label: "Pass 3: node degrees" },             DegreePass::default,             |_state: &mut DegreePass, block| {                 let mut kinds = 0u8;@@ -235,9 +233,7 @@ pub(crate) fn build<W: Write + Send>(         pbf::run_pass_sink(             input,             blobs,-            Some(blob_kinds),-            KIND_WAYS,-            "Pass 4: chains",+            pbf::PassSpec { blob_kinds: Some(blob_kinds), want: KIND_WAYS, label: "Pass 4: chains" },             ChainPass::default,             |state: &mut ChainPass, block| {                 chain_blob(state, block, index, coords, degree, stop, filter, &ends)
scripts/maps/osm_ingest/src/chains_part1.rs
diff --git a/scripts/maps/osm_ingest/src/chains_part1.rs b/scripts/maps/osm_ingest/src/chains_part1.rsindex 2a9ad6705f..b245215d4d 100644--- a/scripts/maps/osm_ingest/src/chains_part1.rs+++ b/scripts/maps/osm_ingest/src/chains_part1.rs@@ -98,8 +98,8 @@ impl Spill {     /// byte-deterministic.     pub fn writer(&self) -> Result<SpillWriter> {         self.make_dirs()?;-        let mut hdr = BufWriter::with_capacity(8 << 20, create(&self.hdr)?);-        let mut pts = BufWriter::with_capacity(8 << 20, create(&self.pts)?);+        let hdr = BufWriter::with_capacity(8 << 20, create(&self.hdr)?);+        let pts = BufWriter::with_capacity(8 << 20, create(&self.pts)?);         // The appends run on threads of their own — one per file, since the two         // are independent streams — so the chain pass's ordered sink hands         // buffers over instead of copying ~45 GB (planet) through write(2)@@ -196,14 +196,15 @@ impl Spill {     #[cfg(test)]     pub fn read_all(&self) -> Result<(Vec<ChainRec>, Vec<geom::Pt>)> {         let count = self.chain_count()?;-        let mut hdr = self.headers()?;+        let hdr = self.headers_mapped()?;         let mut chains = Vec::with_capacity(count as usize);-        while let Some(c) = hdr.next()? {-            chains.push(c);+        for i in 0..count {+            chains.push(hdr.get(i)?);         }          let bytes = self.point_bytes()?;-        let mut src = BufReader::new(open(&self.pts)?);+        use std::io::Read as _;+        let mut src = std::io::BufReader::new(open(&self.pts)?);         let mut buf = [0u8; CHAIN_PT_BYTES as usize];         let mut pts = Vec::with_capacity((bytes / CHAIN_PT_BYTES) as usize);         for _ in 0..bytes / CHAIN_PT_BYTES {@@ -213,16 +214,6 @@ impl Spill {         Ok((chains, pts))     } -    /// Sequential reader over `chains.hdr`. Every stage after the chain pass is one-    /// of these: the degree count for the CSR, the target scatter, and the single-    /// round-assignment scan feeding [`Spill::headers_mapped`](Self::headers_mapped).-    pub fn headers(&self) -> Result<HeaderReader> {-        Ok(HeaderReader {-            src: BufReader::with_capacity(1 << 20, open(&self.hdr)?),-            left: self.chain_count()?,-        })-    }-     /// Random-access reader over `chains.hdr`, for the write rounds.     ///     /// Records are fixed-stride (`CHAIN_REC_BYTES` each), so chain `i` starts@@ -285,6 +276,7 @@ fn create(path: &Path) -> Result<File> {     File::create(path).map_err(|e| Error(format!("cannot write {}: {e}", path.display()))) } +#[cfg(test)] fn open(path: &Path) -> Result<File> {     File::open(path).map_err(|e| Error(format!("cannot read {}: {e}", path.display()))) }@@ -297,14 +289,18 @@ fn decode_pt(b: &[u8]) -> geom::Pt { }  /// Streams `chains.hdr` and `chains.pts` from the front.+/// Sender for one spill file's writer thread.+type SpillSender = std::sync::mpsc::SyncSender<Vec<u8>>;+/// The two spill writer threads: `(chains.hdr, chains.pts)`.+type SpillThreads = (+    std::thread::JoinHandle<std::io::Result<()>>,+    std::thread::JoinHandle<std::io::Result<()>>,+);+ pub(crate) struct SpillWriter {     /// Buffers for the writer thread, in order: `(chains.hdr bytes, chains.pts bytes)`.-    tx: Option<(std::sync::mpsc::SyncSender<Vec<u8>>, std::sync::mpsc::SyncSender<Vec<u8>>)>,-    #[allow(clippy::type_complexity)]-    thread: Option<(-        std::thread::JoinHandle<std::io::Result<()>>,-        std::thread::JoinHandle<std::io::Result<()>>,-    )>,+    tx: Option<(SpillSender, SpillSender)>,+    thread: Option<SpillThreads>,     /// Points written so far, which is the next chain's `pts_start`.     pub(crate) points: u64,     chains: u64,@@ -316,6 +312,7 @@ impl SpillWriter {     /// `ids` are the chain's dense node ids in order; their coordinates go to     /// `chains.pts` and only the two endpoint *ids* are kept, in the header, since     /// coordinates cannot be mapped back to a node.+    #[cfg(test)]     pub fn push(&mut self, c: &Chain, ids: &[u32], coords: &[geom::Pt]) -> Result<()> {         debug_assert_eq!(ids.len(), c.pts_len as usize);         let mut rec = [0u8; CHAIN_REC_BYTES as usize];@@ -347,7 +344,7 @@ impl SpillWriter {     /// Append chains already encoded by [`build`]'s workers: `hdr` holds whole     /// header records whose `pts_start` the caller has rebased onto     /// [`SpillWriter::points`], and `pts` the `points` coordinates they cover.-    /// Same bytes as [`SpillWriter::push`] per chain; the write itself happens+    /// Same bytes as a per-chain encode would produce; the write itself happens     /// on the writer thread, in the order of these calls.     pub fn push_encoded(&mut self, hdr: Vec<u8>, pts: Vec<u8>, points: u64) -> Result<()> {         debug_assert_eq!(hdr.len() as u64 % CHAIN_REC_BYTES, 0);@@ -389,25 +386,6 @@ impl Drop for SpillWriter {     } } -/// Streams `chains.hdr` from the front.-pub(crate) struct HeaderReader {-    src: BufReader<File>,-    left: u64,-}--impl HeaderReader {-    #[allow(clippy::should_implement_trait)]-    pub fn next(&mut self) -> Result<Option<ChainRec>> {-        if self.left == 0 {-            return Ok(None);-        }-        let mut rec = [0u8; CHAIN_REC_BYTES as usize];-        self.src.read_exact(&mut rec).map_err(io_err)?;-        self.left -= 1;-        Ok(Some(ChainRec::decode(&rec)))-    }-}- /// Random-access view over `chains.hdr`. See [`Spill::headers_mapped`]. pub(crate) struct HeaderMap {     map: crate::mem::Mapped,@@ -453,23 +431,7 @@ pub(crate) fn points_map(reader: &PointReader) -> &crate::mem::Mapped { }  impl PointReader {-    /// Replace `out` with the `len` points starting at point index `start`.-    ///-    /// A slice of one persistent mapping, not a positional read: the write-    /// rounds visit chains in edge order, not chain order, so a `File` paid-    /// one syscall per edge (~300 M at planet scale) for a few dozen bytes-    /// each. The mapping faults the same pages with zero syscalls, no-    /// per-edge buffer zeroing, and no cursor to keep — which is also what a-    /// parallel writer would need first.-    ///-    /// Short reads fail exactly as the positional path did (`UnexpectedEof`-    /// naming the file), so a truncated spill surfaces here rather than as a-    /// wrong polyline downstream.-    pub fn read(&mut self, start: u64, len: u32, out: &mut Vec<geom::Pt>) -> Result<()> {-        Self::read_from(&self.map, start, len, out)-    }--    /// [`read`](Self::read) over an explicit mapping: the shared-read form.+    /// Read over an explicit mapping: the shared-read form.     ///     /// `read` takes `&mut self` for the historical reason that the reader     /// used to hold a cursor; the mapping itself is never mutated, so pool@@ -487,7 +449,7 @@ impl PointReader {         let at = start as u128 * CHAIN_PT_BYTES as u128;         let bytes = len as u128 * CHAIN_PT_BYTES as u128;         if at + bytes > map.len() as u128 {-            return Err(Error(format!("chains.pts ended mid-chain")));+            return Err(Error("chains.pts ended mid-chain".to_string()));         }         let (at, bytes) = (at as usize, bytes as usize);         out.extend(map[at..at + bytes].chunks_exact(CHAIN_PT_BYTES as usize).map(decode_pt));
scripts/maps/osm_ingest/src/compact.rs
diff --git a/scripts/maps/osm_ingest/src/compact.rs b/scripts/maps/osm_ingest/src/compact.rsindex c5437523a4..c79bab24a6 100644--- a/scripts/maps/osm_ingest/src/compact.rs+++ b/scripts/maps/osm_ingest/src/compact.rs@@ -180,8 +180,8 @@ pub fn compact(     // device binary-searches is preserved for free.     out.new_id = vec![REMOVED; n];     let mut next = 0u32;-    for i in 0..n {-        if !interior[i] {+    for (i, &is_interior) in interior.iter().enumerate().take(n) {+        if !is_interior {             out.new_id[i] = next;             next += 1;         }
scripts/maps/osm_ingest/src/graph_build.rs
diff --git a/scripts/maps/osm_ingest/src/graph_build.rs b/scripts/maps/osm_ingest/src/graph_build.rsindex 340f653976..325b50a57b 100644--- a/scripts/maps/osm_ingest/src/graph_build.rs+++ b/scripts/maps/osm_ingest/src/graph_build.rs@@ -89,9 +89,6 @@ const GRAPH_MAGIC: u32 = 0x4752_414D; /// a `u64` offset table). Same records, same order — only the container /// changes. Readers accept 6 and 7; writers emit 7. const GRAPH_VERSION: u32 = 7;-/// Oldest graph version accepted: v6 raw tables still decode.-const GRAPH_VERSION_MIN: u32 = 6;- /// Geometry edges per coarse block in `intermediate.bin`'s two-level offset table /// — `INTERMEDIATE_BLOCK` in `graph.rs`, and the two must agree. ///
scripts/maps/osm_ingest/src/graph_build_part1.rs
diff --git a/scripts/maps/osm_ingest/src/graph_build_part1.rs b/scripts/maps/osm_ingest/src/graph_build_part1.rsindex 1e79f45ddf..40ab8b3576 100644--- a/scripts/maps/osm_ingest/src/graph_build_part1.rs+++ b/scripts/maps/osm_ingest/src/graph_build_part1.rs@@ -5,6 +5,9 @@ /// blobs a second time. Ways are a small minority of a planet file's blobs and /// `blob_kinds` lets the pass skip the rest outright, so the trade is heavily in /// favour of re-reading.+/// One Morton-key piece: its slot range plus its disjoint slice of the key array.+type KeyPiece<'a> = ((usize, usize), &'a mut [(u64, u32)]);+ #[derive(Default)] struct WayPass {     segs: Vec<Seg>,@@ -149,9 +152,7 @@ pub fn build_with(input: &Path, out_dir: &Path, opts: Options) -> Result<Stats>         pbf::run_pass_sink(             input,             &blobs,-            None,-            KIND_NODES | KIND_WAYS,-            "Pass 1: refs + stops",+            pbf::PassSpec { blob_kinds: None, want: KIND_NODES | KIND_WAYS, label: "Pass 1: refs + stops" },             Pass1::default,             |state, block| pass1_blob(state, block, filter, &bits),             |chunk| {@@ -210,9 +211,7 @@ pub fn build_with(input: &Path, out_dir: &Path, opts: Options) -> Result<Stats>         let _ = pbf::run_pass_sink(             input,             &blobs,-            Some(&blob_kinds),-            KIND_NODES,-            "Pass 2: node scan",+            pbf::PassSpec { blob_kinds: Some(&blob_kinds), want: KIND_NODES, label: "Pass 2: node scan" },             Pass2::default,             |state, block| {                 let kinds = pass2_blob(state, block, &mask)?;@@ -248,9 +247,7 @@ pub fn build_with(input: &Path, out_dir: &Path, opts: Options) -> Result<Stats>         let _ = pbf::run_pass_sink(             input,             &blobs,-            Some(&blob_kinds),-            KIND_NODES,-            "Pass 2: node scan (serial)",+            pbf::PassSpec { blob_kinds: Some(&blob_kinds), want: KIND_NODES, label: "Pass 2: node scan (serial)" },             Pass2::default,             |state, block| pass2_blob(state, block, &mask),             |chunk| {@@ -335,7 +332,7 @@ pub fn build_with(input: &Path, out_dir: &Path, opts: Options) -> Result<Stats>         let ranges: Vec<(usize, usize)> = (0..(slots as usize).div_ceil(RANGE))             .map(|r| (r * RANGE, ((r + 1) * RANGE).min(slots as usize)))             .collect();-        let mut pieces: Vec<((usize, usize), &mut [(u64, u32)])> = Vec::with_capacity(ranges.len());+        let mut pieces: Vec<KeyPiece<'_>> = Vec::with_capacity(ranges.len());         let mut rest: &mut [(u64, u32)] = &mut keys;         for &(lo, hi) in &ranges {             // Kept ids below `hi` minus those below `lo`.@@ -533,9 +530,7 @@ fn collapse_segments<W: std::io::Write + Send>(     let way_kinds = pbf::run_pass_sink(         input,         blobs,-        Some(blob_kinds),-        KIND_WAYS,-        "Pass 3: segments",+        pbf::PassSpec { blob_kinds: Some(blob_kinds), want: KIND_WAYS, label: "Pass 3: segments" },         WayPass::default,         |state, block| way_blob(state, block, index, coords, filter),         |chunk| {
scripts/maps/osm_ingest/src/graph_build_part11.rs
diff --git a/scripts/maps/osm_ingest/src/graph_build_part11.rs b/scripts/maps/osm_ingest/src/graph_build_part11.rsindex 048a59e62d..fe7589c911 100644--- a/scripts/maps/osm_ingest/src/graph_build_part11.rs+++ b/scripts/maps/osm_ingest/src/graph_build_part11.rs@@ -222,7 +222,7 @@ impl Census { /// `edge_ptr` is the base plus the edges before it in the batch. Per edge it /// mirrors the serial body exactly: census, twin-check-before-read, polyline /// read + reverse + `geom::fits` + `assert_endpoints` + encode, the narrowing-/// of [`EdgeFile::push`], name and lanes.+/// of `EdgeFile::push`, name and lanes. /// /// Pure over shared tables (`node_coords`, `lane_pool`, `csr`, `synth`, the /// `chains.pts` mapping): safe across the pool. Fallible only like the serial@@ -381,7 +381,7 @@ fn drain_batch(s: &mut WriteSinks, b: &BakedBatch, base: u64) -> Result<()> { impl EdgeFile {     /// Append a baked batch's records and side tables, its first edge being     /// absolute index `base`. Same rows, bits and offsets as calling-    /// [`EdgeFile::push`] once per edge.+    /// `EdgeFile::push` once per edge.     fn push_baked(&mut self, b: &BakedBatch, base: u64) -> Result<()> {         for &(local, target, dist) in &b.escapes {             let idx = cap_u32("escaped edge index", base + u64::from(local))?;@@ -402,7 +402,7 @@ impl EdgeFile { impl GeomFile {     /// Append a baked batch: presence bits, offset entries and polyline bytes     /// for its storing edges, a skip for every other edge. Same state as the-    /// serial sequence of [`GeomFile::store`] / [`GeomFile::skip`] calls, with+    /// serial sequence of `GeomFile::store` / `GeomFile::skip` calls, with     /// the batch's blob going out as one write.     fn store_batch(&mut self, base: u64, b: &BakedBatch) -> Result<()> {         for &(local, len) in &b.geom_runs {
scripts/maps/osm_ingest/src/graph_build_part3.rs
diff --git a/scripts/maps/osm_ingest/src/graph_build_part3.rs b/scripts/maps/osm_ingest/src/graph_build_part3.rsindex 5ebe42782a..3ae5f689f9 100644--- a/scripts/maps/osm_ingest/src/graph_build_part3.rs+++ b/scripts/maps/osm_ingest/src/graph_build_part3.rs@@ -124,11 +124,11 @@ fn reconnect_isolated_stops(coords: &[geom::Pt], stops: &Bitset, csr: &Csr) -> R             while radius <= 1_000_000 {                 let lo = (i as usize).saturating_sub(radius);                 let hi = (i as usize + radius).min(n);-                for j in lo..hi {+                for (j, coord) in coords.iter().enumerate().take(hi).skip(lo) {                     if !routable(j as u32) {                         continue;                     }-                    let d = accurate_dist_mm(stop.0, stop.1, coords[j].0, coords[j].1);+                    let d = accurate_dist_mm(stop.0, stop.1, coord.0, coord.1);                     if best.is_none_or(|(bd, _)| d < bd) {                         best = Some((d, j as u32));                     }@@ -298,11 +298,9 @@ fn write_graph(         });         let mut by_round: Vec<Vec<u32>> = vec![Vec::new(); rounds as usize];         let mut sizes = vec![0usize; rounds as usize];-        for p in &parts {-            if let Ok(p) = p {-                for (r, v) in p.iter().enumerate() {-                    sizes[r] += v.len();-                }+        for p in parts.iter().filter_map(|p| p.as_ref().ok()) {+            for (r, v) in p.iter().enumerate() {+                sizes[r] += v.len();             }         }         for (r, v) in by_round.iter_mut().enumerate() {@@ -470,9 +468,6 @@ fn finish_pack(     dem: Option<&crate::dem::Dem>, ) -> Result<Written> {     let mut nodes_blocked = nodes_blocked;-    let mut edges_out = edges_out;-    let mut inter = inter;-    let mut lanes = lanes;     // Trailing sentinel so `graph.rs` can read node(v + 1).edge_ptr as the end of     // node v's edge range.     let mut sentinel = [0u8; 12];
scripts/maps/osm_ingest/src/graph_build_part4.rs
diff --git a/scripts/maps/osm_ingest/src/graph_build_part4.rs b/scripts/maps/osm_ingest/src/graph_build_part4.rsindex 02df042ea5..10403add92 100644--- a/scripts/maps/osm_ingest/src/graph_build_part4.rs+++ b/scripts/maps/osm_ingest/src/graph_build_part4.rs@@ -124,6 +124,7 @@ impl GeomFile {      /// This edge stores no polyline. Its presence bit stays clear and it owns no     /// offset at all, which is the whole point of the bitmap.+    #[cfg(test)]     fn skip(&mut self) {         self.pushed += 1;     }@@ -131,6 +132,7 @@ impl GeomFile {     /// Record `bytes` as this edge's polyline. Called once per storing edge, in     /// ascending edge index, because the rounds ascend and each round writes its     /// edges in index order.+    #[cfg(test)]     fn store(&mut self, bytes: &[u8]) -> Result<()> {         debug_assert!(             !bytes.is_empty(),@@ -147,7 +149,7 @@ impl GeomFile {      /// One `(coarse?, within)` pair for geometry index `self.stored`.     fn push_entry(&mut self) {-        if self.stored.is_multiple_of(INTERMEDIATE_BLOCK) {+        if self.stored % INTERMEDIATE_BLOCK == 0 {             self.block_base = self.blob_len;             self.coarse.push(self.blob_len);         }@@ -177,7 +179,7 @@ impl GeomFile {         // `coarse` is sized by `div_ceil`, so when `G` is not a multiple of the         // block size it holds one slot past the last block the sentinel touched.         // Filling it keeps the table exactly the length the reader computes.-        if !self.stored.is_multiple_of(INTERMEDIATE_BLOCK) {+        if self.stored % INTERMEDIATE_BLOCK != 0 {             self.coarse.push(self.blob_len);         } @@ -331,6 +333,7 @@ impl EdgeFile {     /// computable from counts; the v7 blocked layout is data-dependent, so     /// this covers the trailer and the reader parses the records' end out of     /// the ZBLK header instead.+    #[cfg(test)]     fn total_bytes(edge_count: u64, escapes: u64, named: u64) -> u64 {         let rows = align_up(edge_count * EDGE_REC_BYTES, SECTION_ALIGN)             + (edge_count.div_ceil(ESCAPE_BLOCK) + 1) * 4@@ -354,6 +357,7 @@ impl EdgeFile {      /// Write one directed edge's record, escaping it if either field will not fit and     /// recording its name if it has one.+    #[cfg(test)]     fn push(&mut self, e: &TmpEdge, type_: u8) -> Result<()> {         let (delta, dist) = match target_delta(e.source, e.target) {             Some(d) if e.dist_mm < DIST_MM_ESCAPE => (d, e.dist_mm),@@ -400,7 +404,7 @@ impl EdgeFile {         let mut at = blocked             .finish_into(&mut out)             .map_err(|e| Error(format!("cannot finish {}: {e}", path.display())))?;-        at = pad_to(&mut out, &path, at)?;+        at = pad_to(&mut out, at)?;          // `escape_first[b]` is the index of the first row in block `b`, i.e. the         // count of rows below `b * ESCAPE_BLOCK`. The rows ascend, so one walk over@@ -431,7 +435,7 @@ impl EdgeFile {             out.write_all(&dist_mm.to_le_bytes()).map_err(io_err)?;         }         at += escapes.len() as u64 * 12;-        at = pad_to(&mut out, &path, at)?;+        pad_to(&mut out, at)?;          let named = named.write(&mut out)?;         if named != name_offsets.len() as u64 {@@ -469,7 +473,7 @@ impl EdgeFile { /// /// Free function (not a method): [`EdgeFile::finish`] destructures `self` /// before the trailer, so there is no receiver left to hang it on.-fn pad_to(out: &mut BufWriter<File>, path: &Path, at: u64) -> Result<u64> {+fn pad_to(out: &mut BufWriter<File>, at: u64) -> Result<u64> {     let aligned = align_up(at, SECTION_ALIGN);     let zeroes = [0u8; SECTION_ALIGN as usize];     out.write_all(&zeroes[..(aligned - at) as usize]).map_err(io_err)?;
scripts/maps/osm_ingest/src/graph_build_part5.rs
diff --git a/scripts/maps/osm_ingest/src/graph_build_part5.rs b/scripts/maps/osm_ingest/src/graph_build_part5.rsindex dbfb341513..d33ce23fc1 100644--- a/scripts/maps/osm_ingest/src/graph_build_part5.rs+++ b/scripts/maps/osm_ingest/src/graph_build_part5.rs@@ -96,21 +96,6 @@ impl Drop for LaneFile {     } } -/// `nodes.bin` is 12 bytes a record: `edge_ptr` is a `u32`, which planet's 1.07 G-/// directed edges leave 4x of headroom in. [`cap_u32`] on the edge count is what-/// keeps that safe — a wrapped `edge_ptr` would address a real but wrong node's-/// edge range.-fn write_node<W: Write>(-    out: &mut W,-    lat_e7: i32,-    lon_e7: i32,-    edge_ptr: u32,-) -> std::io::Result<()> {-    out.write_all(&lat_e7.to_le_bytes())?;-    out.write_all(&lon_e7.to_le_bytes())?;-    out.write_all(&edge_ptr.to_le_bytes())-}- fn create(path: &Path) -> Result<File> {     File::create(path).map_err(|e| Error(format!("cannot write {}: {e}", path.display()))) }@@ -131,12 +116,11 @@ pub fn parse_args( ) -> std::result::Result<(PathBuf, PathBuf, Options), String> {     let mut input: Option<PathBuf> = None;     let mut out = PathBuf::from("map_data");-    let mut opts = Options::default();     // The CLI defaults to the streaming within-way collapse: it is the only path     // whose working set fits a planet build on a commodity box. The reference     // whole-graph collapse stays reachable for cross-checking via     // --reference-collapse. The library default (`Options::default`) is unchanged.-    opts.within_way_chains = true;+    let mut opts = Options { within_way_chains: true, ..Default::default() };     let mut i = 0;     while i < args.len() {         match args[i].as_str() {
scripts/maps/osm_ingest/src/graph_build_part6.rs
diff --git a/scripts/maps/osm_ingest/src/graph_build_part6.rs b/scripts/maps/osm_ingest/src/graph_build_part6.rsindex ea29fb1424..a5fca4a003 100644--- a/scripts/maps/osm_ingest/src/graph_build_part6.rs+++ b/scripts/maps/osm_ingest/src/graph_build_part6.rs@@ -106,7 +106,6 @@         name_rank_at: usize,         name_present_at: usize,         name_off_at: usize,-        named_edges: u64,     }      impl<'a> Edges<'a> {@@ -114,7 +113,6 @@             bytes: &'a [u8],             edge_count: u64,             escape_count: u64,-            named_edges: u64,         ) -> Edges<'a> {             // The records may be a ZBLK section (v7 writer) or raw (v6             // fixtures). Either way `records` holds the unpacked array and@@ -157,12 +155,11 @@                 name_rank_at,                 name_present_at: name_rank_at + rank_bytes,                 name_off_at: name_rank_at + PresenceBitmap::bytes(edge_count) as usize,-                named_edges,             }         }          fn of(o: &'a Outputs) -> Edges<'a> {-            Edges::new(&o.edges, meta_u64(o, 16), meta_u64(o, 24), meta_u64(o, 32))+            Edges::new(&o.edges, meta_u64(o, 16), meta_u64(o, 24))         }          /// Unpacked record-array length. The v7 container check.@@ -170,11 +167,6 @@             self.records.len()         } -        /// What the reader will compute the file's length to be.-        fn total_bytes(&self) -> usize {-            self.name_off_at + (self.named_edges * 4) as usize-        }-         /// True when edge `idx` has a name, from the presence bitmap.         fn named(&self, idx: u64) -> bool {             self.bytes[self.name_present_at + (idx / 8) as usize] & (1u8 << (idx % 8)) != 0
scripts/maps/osm_ingest/src/graph_build_part8.rs
diff --git a/scripts/maps/osm_ingest/src/graph_build_part8.rs b/scripts/maps/osm_ingest/src/graph_build_part8.rsindex b6c1fa1cb0..923252d52d 100644--- a/scripts/maps/osm_ingest/src/graph_build_part8.rs+++ b/scripts/maps/osm_ingest/src/graph_build_part8.rs@@ -414,10 +414,12 @@     /// two nodes exactly 32,768 apart in Morton order would mean choosing     /// coordinates for 32,767 nodes in between. So the encoder and the decoder are     /// exercised as a pair directly, which is also where the off-by-one would be.+    type EdgeRoundtrip = (Vec<(u32, u32, u32, u8, u8)>, Vec<u8>, u64);+     fn roundtrip_edges(         tag: &str,         spec: &[(u32, u32, u32)],-    ) -> (Vec<(u32, u32, u32, u8, u8)>, Vec<u8>, u64) {+    ) -> EdgeRoundtrip {         let dir = std::env::temp_dir().join(format!("osm_ingest_edges_{tag}"));         let _ = std::fs::remove_dir_all(&dir);         std::fs::create_dir_all(&dir).unwrap();@@ -427,7 +429,6 @@             f.push(&tmp_edge(*source, *target, *dist), 1).unwrap();         }         let escapes = f.escapes.len() as u64;-        let named = f.name_offsets.len() as u64;         let total = f.finish(count).unwrap();         let bytes = std::fs::read(dir.join("edges.bin")).unwrap();         assert_eq!(bytes.len() as u64, total, "finish() lied about the length");@@ -439,7 +440,7 @@             .expect("the record array is a blocked section");         assert_eq!(blocked.unpacked_len(), count * EDGE_REC_BYTES);         assert_eq!(blocked.record_len(), EDGE_REC_BYTES as usize);-        let e = Edges::new(&bytes, count, escapes, named);+        let e = Edges::new(&bytes, count, escapes);         // The block index's last entry is the row total, which is what the reader         // cross-checks `escape_count` against.         let blocks = count.div_ceil(ESCAPE_BLOCK) + 1;
scripts/maps/osm_ingest/src/graph_build_part9.rs
diff --git a/scripts/maps/osm_ingest/src/graph_build_part9.rs b/scripts/maps/osm_ingest/src/graph_build_part9.rsindex 6fcb7208b4..721ca2f367 100644--- a/scripts/maps/osm_ingest/src/graph_build_part9.rs+++ b/scripts/maps/osm_ingest/src/graph_build_part9.rs@@ -97,7 +97,7 @@         let total = f.finish(n).unwrap();         let bytes = std::fs::read(dir.join("edges.bin")).unwrap();         assert_eq!(bytes.len() as u64, total);-        let e = Edges::new(&bytes, n, escapes, named_count);+        let e = Edges::new(&bytes, n, escapes);         for i in 0..n {             let (target, dist, name, type_, speed) = e.get(0, i);             assert_eq!(target, i as u32);@@ -136,7 +136,7 @@             // v7 record array: blocked, unpacking to exactly the pushed records.             let blocked = tilecodec::blocked::Blocked::parse(&bytes).expect("blocked records");             assert_eq!(blocked.unpacked_len(), n * EDGE_REC_BYTES);-            let e = Edges::new(&bytes, n, 0, named_count);+            let e = Edges::new(&bytes, n, 0);             for i in 0..n {                 let want = if all_named { i as u32 * 3 } else { NO_NAME };                 assert_eq!(e.get(0, i).2, want, "edge {i} with all_named={all_named}");
scripts/maps/osm_ingest/src/nodeloc_part1.rs
diff --git a/scripts/maps/osm_ingest/src/nodeloc_part1.rs b/scripts/maps/osm_ingest/src/nodeloc_part1.rsindex 2439437608..7dbedb92d5 100644--- a/scripts/maps/osm_ingest/src/nodeloc_part1.rs+++ b/scripts/maps/osm_ingest/src/nodeloc_part1.rs@@ -65,9 +65,7 @@ where     pbf::run_pass_sink(         input,         blobs,-        Some(blob_kinds),-        KIND_NODES,-        label,+        pbf::PassSpec { blob_kinds: Some(blob_kinds), want: KIND_NODES, label },         || (Vec::<(u64, i32, i32)>::new(), Vec::<L>::new()),         |state: &mut (Vec<(u64, i32, i32)>, Vec<L>), block| {             let mut kinds = 0u8;
scripts/maps/osm_ingest/src/pbf.rs
diff --git a/scripts/maps/osm_ingest/src/pbf.rs b/scripts/maps/osm_ingest/src/pbf.rsindex 4de76319d4..1c8f43000f 100644--- a/scripts/maps/osm_ingest/src/pbf.rs+++ b/scripts/maps/osm_ingest/src/pbf.rs@@ -294,12 +294,22 @@ impl<'a> PrimitiveBlock<'a> { /// then ways, then relations. A skipped blob's incoming kinds are carried into /// the returned mask, so a filtered pass's mask is still a complete description /// of the file and can be fed to the pass after it.+/// Which blobs a pass wants, and how it is labelled in progress output.+#[derive(Clone, Copy)]+pub struct PassSpec<'a> {+    /// Kind mask from a previous full pass, letting this pass skip blobs that+    /// hold nothing it wants. `None` scans every blob.+    pub blob_kinds: Option<&'a [u8]>,+    /// Bitmask of blob kinds this pass wants.+    pub want: u8,+    /// Progress label.+    pub label: &'a str,+}+ pub fn run_pass_sink<S, F, G, H>(     path: &Path,     blobs: &[BlobLoc],-    blob_kinds: Option<&[u8]>,-    want: u8,-    label: &str,+    spec: PassSpec<'_>,     make: F,     body: G,     sink: H,@@ -406,7 +416,7 @@ where                     let mut state = make();                     for (i, loc) in blobs[start..end].iter().enumerate() {                         let idx = start + i;-                        match blob_kinds.filter(|k| k[idx] & want == 0) {+                        match spec.blob_kinds.filter(|k| k[idx] & spec.want == 0) {                             Some(k) => kinds[idx].store(k[idx], Ordering::Relaxed),                             None => {                                 read_exact_at(&mut file, loc, &mut compressed).map_err(fail)?;@@ -416,7 +426,7 @@ where                                 kinds[idx].store(seen, Ordering::Relaxed);                             }                         }-                        report(label, &done_blobs, &last_pct, blobs.len(), &pass_start);+                        report(spec.label, &done_blobs, &last_pct, blobs.len(), &pass_start);                     }                     shared.lock().expect("chunk slot mutex").slots[chunk] = Some(state);                     drain_thread.unpark();@@ -494,7 +504,7 @@ where         }         if first_err.is_none() && next < n_chunks {             first_err = Some(Error(format!(-                "pass {label}: chunks {next}..{n_chunks} were never produced"+                "pass {}: chunks {next}..{n_chunks} were never produced", spec.label             )));         }     });@@ -510,7 +520,7 @@ where     {         let n = blobs.len();         eprintln!(-            "\r{label:<28} [100%] {n}/{n}  {} elapsed, ETA 0s   ",+            "\r{:<28} [100%] {n}/{n}  {} elapsed, ETA 0s   ", spec.label,             crate::progress::hms(pass_start.elapsed().as_secs_f64()),         );     }@@ -549,7 +559,7 @@ where     G: Fn(&mut S, &PrimitiveBlock) -> Result<u8> + Sync, {     let mut out: Vec<S> = Vec::new();-    let kinds = run_pass_sink(path, blobs, blob_kinds, want, label, make, body, |s| {+    let kinds = run_pass_sink(path, blobs, PassSpec { blob_kinds, want, label }, make, body, |s| {         out.push(s);         Ok(())     })?;
scripts/maps/osm_ingest/src/pbf_extra.rs
diff --git a/scripts/maps/osm_ingest/src/pbf_extra.rs b/scripts/maps/osm_ingest/src/pbf_extra.rsindex c7a4264298..dbd7a72ac9 100644--- a/scripts/maps/osm_ingest/src/pbf_extra.rs+++ b/scripts/maps/osm_ingest/src/pbf_extra.rs@@ -186,9 +186,7 @@ mod tests {         run_pass_sink(             &path,             &blobs,-            None,-            KIND_NODES,-            "window",+            crate::pbf::PassSpec { blob_kinds: None, want: KIND_NODES, label: "window" },             || {                 let n = mk_live.fetch_add(1, Ordering::SeqCst) + 1;                 mk_peak.fetch_max(n, Ordering::SeqCst);
scripts/maps/osm_ingest/src/poi_build.rs
diff --git a/scripts/maps/osm_ingest/src/poi_build.rs b/scripts/maps/osm_ingest/src/poi_build.rsindex 793c770033..dd51dfe440 100644--- a/scripts/maps/osm_ingest/src/poi_build.rs+++ b/scripts/maps/osm_ingest/src/poi_build.rs@@ -173,63 +173,56 @@ struct NodePass {     locs: Vec<(u32, i32, i32)>, } -pub fn build(-    input: &Path,-    geojson: &Path,-    names: &Path,-    index: &Path,-    attrs: &Path,-    spatial: &Path,-    name_index: &Path,-    region: &Path,-) -> Result<Stats> {-    build_with(input, geojson, names, index, attrs, spatial, name_index, region, None)+/// The input PBF and every output file of a POI build, grouped so the build+/// entry points take one paths argument instead of eight loose ones.+#[derive(Clone, Copy)]+pub struct Paths<'a> {+    /// Input `.osm.pbf`.+    pub input: &'a Path,+    /// GeoJSONSeq output.+    pub geojson: &'a Path,+    /// Name pool output.+    pub names: &'a Path,+    /// POI index output.+    pub index: &'a Path,+    /// Attribute sidecar output.+    pub attrs: &'a Path,+    /// Spatial grid output.+    pub spatial: &'a Path,+    /// Name index output.+    pub name_index: &'a Path,+    /// Region (boundary link) output.+    pub region: &'a Path,+}++pub fn build(paths: Paths<'_>) -> Result<Stats> {+    build_with(paths, None) }  /// [`build`] with a region bbox filter: `Some` keeps only POIs touching the /// box, `None` (world) keeps everything. Ways and relations are kept whole /// when any vertex touches — the `complete_ways` rule — so a POI straddling /// the border keeps its true centroid rather than one computed from a clip.-pub fn build_with(-    input: &Path,-    geojson: &Path,-    names: &Path,-    index: &Path,-    attrs: &Path,-    spatial: &Path,-    name_index: &Path,-    region: &Path,-    bbox: Option<crate::bbox::BBox>,-) -> Result<Stats> {-    build_with_reviews(-        input, geojson, names, index, attrs, spatial, name_index, region, bbox, None,-    )+pub fn build_with(paths: Paths<'_>, bbox: Option<crate::bbox::BBox>) -> Result<Stats> {+    build_with_reviews(paths, bbox, None) }  /// [`build_with`] plus an external review table whose rows are appended to the /// matching POIs' attribute records (see [`crate::poi_reviews`]).-#[allow(clippy::too_many_arguments)] pub fn build_with_reviews(-    input: &Path,-    geojson: &Path,-    names: &Path,-    index: &Path,-    attrs: &Path,-    spatial: &Path,-    name_index: &Path,-    region: &Path,+    paths: Paths<'_>,     bbox: Option<crate::bbox::BBox>,     reviews: Option<&ReviewTable>, ) -> Result<Stats> {     build_inner(-        input,-        geojson,-        names,-        index,-        attrs,-        spatial,-        name_index,-        region,+        paths.input,+        paths.geojson,+        paths.names,+        paths.index,+        paths.attrs,+        paths.spatial,+        paths.name_index,+        paths.region,         bbox,         match reviews {             Some(t) => Reviews::Ready(t),@@ -252,29 +245,21 @@ pub type ReviewLoader = std::thread::JoinHandle<Result<ReviewTable>>; /// /// `on_loaded` runs once with the joined table (the binary prints its row /// count there).-#[allow(clippy::too_many_arguments)] pub fn build_with_review_loader(-    input: &Path,-    geojson: &Path,-    names: &Path,-    index: &Path,-    attrs: &Path,-    spatial: &Path,-    name_index: &Path,-    region: &Path,+    paths: Paths<'_>,     bbox: Option<crate::bbox::BBox>,     loader: ReviewLoader,     on_loaded: &dyn Fn(&ReviewTable), ) -> Result<Stats> {     build_inner(-        input,-        geojson,-        names,-        index,-        attrs,-        spatial,-        name_index,-        region,+        paths.input,+        paths.geojson,+        paths.names,+        paths.index,+        paths.attrs,+        paths.spatial,+        paths.name_index,+        paths.region,         bbox,         Reviews::Loading(Some(loader), on_loaded, None),     )
scripts/maps/osm_ingest/src/poi_build_part2.rs
diff --git a/scripts/maps/osm_ingest/src/poi_build_part2.rs b/scripts/maps/osm_ingest/src/poi_build_part2.rsindex 072dfc3717..1f0db320a8 100644--- a/scripts/maps/osm_ingest/src/poi_build_part2.rs+++ b/scripts/maps/osm_ingest/src/poi_build_part2.rs@@ -87,16 +87,7 @@ mod tests {      fn build_sample(tag: &str) -> (Stats, PathBuf) {         let (pbf_path, dir) = testpbf::write_sample(tag);-        let stats = build(-            &pbf_path,-            &dir.join("pois.geojsonseq"),-            &dir.join("poi_names.bin"),-            &dir.join("poi_index.bin"),-            &dir.join("poi_attrs.bin"),-            &dir.join("poi_spatial.bin"),-            &dir.join("poi_name_index.bin"),-            &dir.join("poi_region.bin"),-        )+        let stats = build(Paths { input: &pbf_path, geojson: &dir.join("pois.geojsonseq"), names: &dir.join("poi_names.bin"), index: &dir.join("poi_index.bin"), attrs: &dir.join("poi_attrs.bin"), spatial: &dir.join("poi_spatial.bin"), name_index: &dir.join("poi_name_index.bin"), region: &dir.join("poi_region.bin") })         .unwrap();         (stats, dir)     }@@ -203,16 +194,7 @@ mod tests {     fn two_runs_are_byte_identical() {         let (pbf_path, dir) = testpbf::write_sample("poi_det");         let run = |suffix: &str| {-            build(-                &pbf_path,-                &dir.join(format!("pois{suffix}.geojsonseq")),-                &dir.join(format!("names{suffix}.bin")),-                &dir.join(format!("index{suffix}.bin")),-                &dir.join(format!("attrs{suffix}.bin")),-                &dir.join(format!("spatial{suffix}.bin")),-                &dir.join(format!("nameidx{suffix}.bin")),-                &dir.join(format!("region{suffix}.bin")),-            )+            build(Paths { input: &pbf_path, geojson: &dir.join(format!("pois{suffix}.geojsonseq")), names: &dir.join(format!("names{suffix}.bin")), index: &dir.join(format!("index{suffix}.bin")), attrs: &dir.join(format!("attrs{suffix}.bin")), spatial: &dir.join(format!("spatial{suffix}.bin")), name_index: &dir.join(format!("nameidx{suffix}.bin")), region: &dir.join(format!("region{suffix}.bin")) })             .unwrap();         };         run("a");@@ -287,16 +269,7 @@ mod tests {     #[test]     fn boundary_links_resolve_member_first_then_containment() {         let (pbf_path, dir) = testpbf::write_region_sample("poi_region");-        let stats = build(-            &pbf_path,-            &dir.join("pois.geojsonseq"),-            &dir.join("poi_names.bin"),-            &dir.join("poi_index.bin"),-            &dir.join("poi_attrs.bin"),-            &dir.join("poi_spatial.bin"),-            &dir.join("poi_name_index.bin"),-            &dir.join("poi_region.bin"),-        )+        let stats = build(Paths { input: &pbf_path, geojson: &dir.join("pois.geojsonseq"), names: &dir.join("poi_names.bin"), index: &dir.join("poi_index.bin"), attrs: &dir.join("poi_attrs.bin"), spatial: &dir.join("poi_spatial.bin"), name_index: &dir.join("poi_name_index.bin"), region: &dir.join("poi_region.bin") })         .unwrap();         let (records, _) = read_records(&dir);         assert_eq!(records.len(), 4);@@ -337,18 +310,7 @@ mod tests {             testpbf::CAFE_NODE_ID,         ))         .unwrap();-        let stats = build_with_reviews(-            &pbf_path,-            &dir.join("pois.geojsonseq"),-            &dir.join("poi_names.bin"),-            &dir.join("poi_index.bin"),-            &dir.join("poi_attrs.bin"),-            &dir.join("poi_spatial.bin"),-            &dir.join("poi_name_index.bin"),-            &dir.join("poi_region.bin"),-            None,-            Some(&table),-        )+        let stats = build_with_reviews(Paths { input: &pbf_path, geojson: &dir.join("pois.geojsonseq"), names: &dir.join("poi_names.bin"), index: &dir.join("poi_index.bin"), attrs: &dir.join("poi_attrs.bin"), spatial: &dir.join("poi_spatial.bin"), name_index: &dir.join("poi_name_index.bin"), region: &dir.join("poi_region.bin") }, None, Some(&table))         .unwrap();         assert_eq!(stats.with_reviews, 3); 
scripts/maps/osm_ingest/src/poi_build_part3.rs
diff --git a/scripts/maps/osm_ingest/src/poi_build_part3.rs b/scripts/maps/osm_ingest/src/poi_build_part3.rsindex 04c9466035..ae706b0c39 100644--- a/scripts/maps/osm_ingest/src/poi_build_part3.rs+++ b/scripts/maps/osm_ingest/src/poi_build_part3.rs@@ -70,7 +70,7 @@ impl RingIndex {             max_y = max_y.max(y);         }         let span = max_y - min_y;-        let bands = if n < 3 || !(span > 0.0) {+        let bands = if n < 3 || span.partial_cmp(&0.0) != Some(std::cmp::Ordering::Greater) {             1         } else {             (n / EDGES_PER_BAND).clamp(1, MAX_BANDS)@@ -186,7 +186,7 @@ where             })             .collect();         // The stats are a per-call report nobody reads on this path.-        let polys = rings::assemble(&members, &locate, &mut RingStats::default());+        let polys = rings::assemble(&members, locate, &mut RingStats::default());         if polys.is_empty() {             return None;         }@@ -385,7 +385,7 @@ mod region_index_tests {         let flat = vec![(0.0, 1.0), (1.0, 1.0), (2.0, 1.0), (0.0, 1.0)];         let idx = RingIndex::new(&flat);         assert!(!idx.contains((1.0, 1.0), &flat));-        assert_eq!(rings::point_in_ring((1.0, 1.0), &flat), false);+        assert!(!rings::point_in_ring((1.0, 1.0), &flat));         let tiny = vec![(0.0, 0.0), (1.0, 1.0)];         assert!(!RingIndex::new(&tiny).contains((0.5, 0.5), &tiny));     }
scripts/maps/osm_ingest/src/poi_build_part4.rs
diff --git a/scripts/maps/osm_ingest/src/poi_build_part4.rs b/scripts/maps/osm_ingest/src/poi_build_part4.rsindex 0123483072..ed464afa8b 100644--- a/scripts/maps/osm_ingest/src/poi_build_part4.rs+++ b/scripts/maps/osm_ingest/src/poi_build_part4.rs@@ -196,16 +196,7 @@ mod admin_tests {     #[test]     fn the_admin_table_walks_linked_boundaries_to_the_top() {         let (pbf_path, dir) = testpbf::write_admin_sample("poi_admin");-        let stats = build(-            &pbf_path,-            &dir.join("pois.geojsonseq"),-            &dir.join("poi_names.bin"),-            &dir.join("poi_index.bin"),-            &dir.join("poi_attrs.bin"),-            &dir.join("poi_spatial.bin"),-            &dir.join("poi_name_index.bin"),-            &dir.join("poi_region.bin"),-        )+        let stats = build(Paths { input: &pbf_path, geojson: &dir.join("pois.geojsonseq"), names: &dir.join("poi_names.bin"), index: &dir.join("poi_index.bin"), attrs: &dir.join("poi_attrs.bin"), spatial: &dir.join("poi_spatial.bin"), name_index: &dir.join("poi_name_index.bin"), region: &dir.join("poi_region.bin") })         .unwrap();         let admin = read_admin(&dir);         assert_eq!(stats.admin_entries, 3);
scripts/maps/osm_ingest/src/poi_reviews.rs
diff --git a/scripts/maps/osm_ingest/src/poi_reviews.rs b/scripts/maps/osm_ingest/src/poi_reviews.rsindex 40ae7f7360..3ca8ac2dbd 100644--- a/scripts/maps/osm_ingest/src/poi_reviews.rs+++ b/scripts/maps/osm_ingest/src/poi_reviews.rs@@ -172,8 +172,11 @@ fn parse_chunk(text: &str) -> (usize, ChunkRows) {     (lines, Ok(out)) } +/// One parsed table line, keyed by `(element kind, OSM id)`.+type ParsedLine = std::result::Result<Option<((u8, i64), Review)>, String>;+ /// One table line: `Ok(None)` for a blank or comment line.-fn parse_line(line: &str) -> std::result::Result<Option<((u8, i64), Review)>, String> {+fn parse_line(line: &str) -> ParsedLine {     let line = line.trim_end_matches('\r');     if line.trim().is_empty() || line.starts_with('#') {         return Ok(None);
scripts/maps/osm_ingest/src/timing.rs
diff --git a/scripts/maps/osm_ingest/src/timing.rs b/scripts/maps/osm_ingest/src/timing.rsindex 408b66a03e..d1e0525f10 100644--- a/scripts/maps/osm_ingest/src/timing.rs+++ b/scripts/maps/osm_ingest/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/osm_ingest/tests/extract_part4.rs
diff --git a/scripts/maps/osm_ingest/tests/extract_part4.rs b/scripts/maps/osm_ingest/tests/extract_part4.rsindex e1df461324..8aca4febaf 100644--- a/scripts/maps/osm_ingest/tests/extract_part4.rs+++ b/scripts/maps/osm_ingest/tests/extract_part4.rs@@ -1,6 +1,6 @@ #[cfg(test)] mod tests_part4 {-    use osm_ingest::extract::{parse_args, Args, Layer}; use std::path::PathBuf;+    use osm_ingest::extract::{parse_args, Layer}; use std::path::PathBuf;      #[test]     fn args_need_a_layer_and_an_out() {