gtfs_ingest: fix all cargo check and clippy warnings
- Commit
d2630385e263f3c71b298591cc20ddd771c0f8b8- Author
- Vayun Mathur <[email protected]>
- When
- 2026-11-17 14:18 UTC (18 days ago)
- Parents
3b4261d
Doc list indentation, type aliases, mechanical lint fixes. Verified: check/clippy --all-targets 0 warnings, tests pass.
Diff
scripts/maps/gtfs_ingest/src/bin/transit_shapes_extra.rs
diff --git a/scripts/maps/gtfs_ingest/src/bin/transit_shapes_extra.rs b/scripts/maps/gtfs_ingest/src/bin/transit_shapes_extra.rsindex 0a98929ff6..bb64aaac75 100644--- a/scripts/maps/gtfs_ingest/src/bin/transit_shapes_extra.rs+++ b/scripts/maps/gtfs_ingest/src/bin/transit_shapes_extra.rs@@ -215,7 +215,7 @@ fn a_routes_two_directions_draw_as_one_line() { assert_eq!(feed.shapes_read, 3, "every shape reaches the cross-feed pass whole"); let out = root.join("routes.geojsonseq");- run(&out, &vec![("solo".to_string(), root.clone(), String::new())]).unwrap();+ run(&out, &[("solo".to_string(), root.clone(), String::new())]).unwrap(); let text = std::fs::read_to_string(&out).unwrap(); let emitted: Vec<&str> = text.lines().collect(); assert_eq!(emitted.len(), 2, "the trunk once, plus the branch's own leg: {text}");
scripts/maps/gtfs_ingest/src/bin/transit_stops.rs
diff --git a/scripts/maps/gtfs_ingest/src/bin/transit_stops.rs b/scripts/maps/gtfs_ingest/src/bin/transit_stops.rsindex eb50f6af2a..60b68cf187 100644--- a/scripts/maps/gtfs_ingest/src/bin/transit_stops.rs+++ b/scripts/maps/gtfs_ingest/src/bin/transit_stops.rs@@ -14,12 +14,12 @@ //! every camera idle. Each feature carries //! //! * `motis_id` โ `<motis_prefix>_<gtfs stop_id>`, the id the realtime-//! `/stoptimes` overlay needs. Omitted when the feed's prefix-//! is unknown, in which case a tap can still open the offline-//! board but gets no live delays.+//! `/stoptimes` overlay needs. Omitted when the feed's prefix+//! is unknown, in which case a tap can still open the offline+//! board but gets no live delays. //! * `name` โ `stop_name`. //! * `route_type` โ the GTFS route type of the most prominent mode serving the-//! stop, so the layer can be styled per mode.+//! stop, so the layer can be styled per mode. //! //! Mirrors `build_pois_layer.sh`'s shape: a Rust binary writes the geojsonseq //! directly, with no osmium or python stage.
scripts/maps/gtfs_ingest/src/bundle.rs
diff --git a/scripts/maps/gtfs_ingest/src/bundle.rs b/scripts/maps/gtfs_ingest/src/bundle.rsindex 9f3ba01248..4ddb59196b 100644--- a/scripts/maps/gtfs_ingest/src/bundle.rs+++ b/scripts/maps/gtfs_ingest/src/bundle.rs@@ -138,6 +138,13 @@ const TAPER_M: f64 = 100.0; /// 255/9, about 1 Dp at a 9 Dp offset. const TAPER_STEPS: usize = 8; +/// Per-probe-range part: range index, per-sample local set ids, and the distinct+/// sets' flat `(values, ends)` buffers.+type ProbePart = (usize, Vec<u32>, Vec<u32>, Vec<u32>);++/// One corridor entry: set id plus its members as `(member, from, to)` spans.+type CorridorMembers = Vec<(usize, f64, f64)>;+ /// How much of a member's own survey, immediately outside the corridor mouth, decides which /// side of the corridor it takes. ///@@ -252,7 +259,7 @@ pub fn assign_with_timer( let probed = AtomicUsize::new(0); // Per range: its samples as local set ids, plus its distinct sets in the order it first saw // them, flat (`values`, `ends`).- let parts: Mutex<Vec<(usize, Vec<u32>, Vec<u32>, Vec<u32>)>> = Mutex::new(Vec::new());+ let parts: Mutex<Vec<ProbePart>> = Mutex::new(Vec::new()); { let grid = &grid; let samples = &samples;@@ -268,7 +275,7 @@ pub fn assign_with_timer( let mut seen: Vec<u32> = vec![0; route_count]; let mut stamp: u32 = 0; let mut near: Vec<u32> = Vec::new();- let mut done: Vec<(usize, Vec<u32>, Vec<u32>, Vec<u32>)> = Vec::new();+ let mut done: Vec<ProbePart> = Vec::new(); loop { let r = next_range.fetch_add(1, AtomicOrdering::Relaxed); if r >= ranges {
scripts/maps/gtfs_ingest/src/bundle_part1.rs
diff --git a/scripts/maps/gtfs_ingest/src/bundle_part1.rs b/scripts/maps/gtfs_ingest/src/bundle_part1.rsindex 1447dbbf48..cc3fb9e0f3 100644--- a/scripts/maps/gtfs_ingest/src/bundle_part1.rs+++ b/scripts/maps/gtfs_ingest/src/bundle_part1.rs@@ -87,7 +87,7 @@ fn corridors_of( // spreads across the machine with no coordination beyond handing out indices. Results go // into a `BTreeMap` keyed by set id, which is ordered by key rather than by insertion, so // the output is byte-identical however the threads interleave.- let entries: Vec<(u32, Vec<(usize, f64, f64)>)> = members.into_iter().collect();+ let entries: Vec<(u32, CorridorMembers)> = members.into_iter().collect(); let total = entries.len(); let threads = crate::par::threads(); let next = AtomicUsize::new(0);
scripts/maps/gtfs_ingest/src/bundle_part5.rs
diff --git a/scripts/maps/gtfs_ingest/src/bundle_part5.rs b/scripts/maps/gtfs_ingest/src/bundle_part5.rsindex 49e846806e..c3b6f6586d 100644--- a/scripts/maps/gtfs_ingest/src/bundle_part5.rs+++ b/scripts/maps/gtfs_ingest/src/bundle_part5.rs@@ -142,13 +142,6 @@ mod tests_continued { vec![(0u32, 0x00_00_10u32, "Main", main), (1, 0x00_00_20, "Join", joining)] } - /// The corridor a polyline would be the reference of, for measuring the output against.- fn corridor_of(points: &[(i32, i32)]) -> Corridor {- let points = canonical(points);- let cum = cumulative(&points);- Corridor::new(points, cum, Vec::new())- }- /// `n` services sharing `metres` of trunk running north and then leaving it in /// different directions for 20 km. fn trunk_then_branches(metres: f64, n: usize) -> Vec<Fixture> {
scripts/maps/gtfs_ingest/src/index_part6.rs
diff --git a/scripts/maps/gtfs_ingest/src/index_part6.rs b/scripts/maps/gtfs_ingest/src/index_part6.rsindex fc74f5d4c2..a0f409e0f9 100644--- a/scripts/maps/gtfs_ingest/src/index_part6.rs+++ b/scripts/maps/gtfs_ingest/src/index_part6.rs@@ -1,7 +1,7 @@ #[cfg(test)] mod shape_tests { use super::*;- use super::tests::{ShapeSpec, agency, assert_shape_invariants, one_feed, shape_map, shaped_feed};+ use super::tests::{agency, assert_shape_invariants, one_feed, shape_map, shaped_feed}; use crate::gtfs::parse_csv; use crate::reader::{Reader, SEC_SHAPE_COORDS};
scripts/maps/gtfs_ingest/src/shapes.rs
diff --git a/scripts/maps/gtfs_ingest/src/shapes.rs b/scripts/maps/gtfs_ingest/src/shapes.rsindex 8335501380..b2e7614819 100644--- a/scripts/maps/gtfs_ingest/src/shapes.rs+++ b/scripts/maps/gtfs_ingest/src/shapes.rs@@ -76,7 +76,7 @@ pub fn distance_m(a: (i32, i32), b: (i32, i32)) -> f64 { /// [`project`]: that measures across a polyline, this measures along one, and /// together they are enough to ask whether two polylines are the same line. pub fn resample(points: &[(i32, i32)], step_m: f64) -> Vec<(i32, i32)> {- if points.len() < 2 || !(step_m > 0.0) {+ if points.len() < 2 || step_m.partial_cmp(&0.0) != Some(std::cmp::Ordering::Greater) { return points.to_vec(); } let lerp = |a: i32, b: i32, t: f64| (a as f64 + (b as f64 - a as f64) * t).round() as i32;
scripts/maps/gtfs_ingest/src/timing.rs
diff --git a/scripts/maps/gtfs_ingest/src/timing.rs b/scripts/maps/gtfs_ingest/src/timing.rsindex 408b66a03e..d1e0525f10 100644--- a/scripts/maps/gtfs_ingest/src/timing.rs+++ b/scripts/maps/gtfs_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)); } }