Modern Apps git

← Modern-Apps.git

map_renderer: fix clippy warnings

Commit
28efeb8d767a3438211f207bff028451ab117941
Author
Vayun Mathur <[email protected]>
When
2026-11-17 14:14 UTC (18 days ago)
Parents
841d41b
Bring cargo check and cargo clippy for the map_renderer crate to
zero warnings on host targets, without any new allow attributes.

Remove genuinely unused imports and the dead mesh_for helper in
tests_extra2, and drop needless borrows, useless vec! uses and
same-type casts in tests (via cargo clippy --fix, reviewed by
hand). Collapse a nested if and a match-to-? in production code,
simplify map_or(true, ..) to is_none_or, and replace negated
partial-order comparisons with explicit partial_cmp matches so
the NaN behaviour stays visible. Move constant assertions into
const blocks and give the complex real-tile test type a name.

Handle platform-only code by gating rather than allowing it:
the timing module and its Android-only nanos_since helper, and
the geometry ground-sampling re-export used only by the Vulkan
renderer, are now compiled only where they are used. The overlay
test imports project/stroke itself instead of relying on the
parent module re-exporting them for its glob import, and
discover() now calls manifest_path instead of duplicating the
manifest path, so the helper is no longer dead.

Bundle parameters to fix too-many-arguments: FlatCap for the
roof lid, CurvedScale for curved-label emission, and TileRef
for the globe placement helpers, updating the Android renderer
call sites to match.

Dependency crates reached through -p map_renderer (tilecodec,
jni_http and the tilecodec write-feature crates) still warn;
they are separate workspace crates outside library/map and are
left untouched.

Verified with cargo check -p map_renderer --all-targets and
cargo clippy -p map_renderer --all-targets (zero map_renderer
warnings), cargo test -p map_renderer (563 unit tests plus
integration tests green), and an aarch64-linux-android lib
check, which compiles with no new warnings.

Diff

library/map/src/main/rust/src/camera_extra.rs
diff --git a/library/map/src/main/rust/src/camera_extra.rs b/library/map/src/main/rust/src/camera_extra.rsindex 1e6fe5dfe9..d5357af206 100644--- a/library/map/src/main/rust/src/camera_extra.rs+++ b/library/map/src/main/rust/src/camera_extra.rs@@ -278,8 +278,8 @@ impl Camera {     /// `a = [a_u, a_v, a_0]` and `b = [b_u, b_v, b_0]` give the bearing-rotated screen offset of     /// a tile-local point `(u, v)` from the camera centre, in world px (Dp): `sx = a_u*u + a_v*v     /// + a_0`, `sy = b_u*u + b_v*v + b_0`. The matrix maps `(u, v, height, 1)`; the third input-    /// is a world-px height above the ground plane (0 for every flat 2D layer, a real height for-    /// buildings/terrain).+    ///   is a world-px height above the ground plane (0 for every flat 2D layer, a real height for+    ///   buildings/terrain).     ///     /// # Camera model (the seam WS-G extends to a heightfield)     ///
library/map/src/main/rust/src/lib.rs
diff --git a/library/map/src/main/rust/src/lib.rs b/library/map/src/main/rust/src/lib.rsindex e342a05104..4a4a1aab2e 100644--- a/library/map/src/main/rust/src/lib.rs+++ b/library/map/src/main/rust/src/lib.rs@@ -50,6 +50,9 @@ pub mod range_alloc; pub mod style; pub mod tess; pub mod tile;+// Frame timing is consumed only by the Android bridge/Vulkan renderer;+// on host it exists solely for its own unit tests.+#[cfg(any(target_os = "android", test))] pub mod timing;  #[cfg(target_os = "android")]
library/map/src/main/rust/src/marker.rs
diff --git a/library/map/src/main/rust/src/marker.rs b/library/map/src/main/rust/src/marker.rsindex ed5fe41c58..4de0e76a48 100644--- a/library/map/src/main/rust/src/marker.rs+++ b/library/map/src/main/rust/src/marker.rs@@ -260,8 +260,8 @@ mod tests {     /// and the 4 Dp gap puts the label start 18 Dp from the anchor.     #[test]     fn marker_label_starts_clear_of_the_icon_edge() {-        assert!(MARKER_SIZE_DP > 0.0 && MARKER_LABEL_GAP_DP > 0.0);-        assert!(MARKER_LABEL_DP > 0.0, "the label has a real size");+        const { assert!(MARKER_SIZE_DP > 0.0 && MARKER_LABEL_GAP_DP > 0.0) };+        const { assert!(MARKER_LABEL_DP > 0.0) };         let label_start = MARKER_SIZE_DP * 0.5 + MARKER_LABEL_GAP_DP;         assert!((label_start - 18.0).abs() < 1e-6, "{label_start}");     }
library/map/src/main/rust/src/overlay.rs
diff --git a/library/map/src/main/rust/src/overlay.rs b/library/map/src/main/rust/src/overlay.rsindex f87481c721..3ab1fddd0c 100644--- a/library/map/src/main/rust/src/overlay.rs+++ b/library/map/src/main/rust/src/overlay.rs@@ -49,8 +49,7 @@ //! route's bounding box, so a continent-crossing route resolves to about a hundredth of a //! Dp on screen — invisible — while a city-scale one is exact to well under a pixel. -use crate::camera::{project, WorldPx};-use crate::tess::stroke;+use crate::camera::WorldPx;  /// Local coordinate resolution of the route's bounding square. ///
library/map/src/main/rust/src/overlay_tests.rs
diff --git a/library/map/src/main/rust/src/overlay_tests.rs b/library/map/src/main/rust/src/overlay_tests.rsindex ab65ea8505..8ca510730f 100644--- a/library/map/src/main/rust/src/overlay_tests.rs+++ b/library/map/src/main/rust/src/overlay_tests.rs@@ -1,5 +1,6 @@     use super::*;-    use crate::camera::Camera;+    use crate::camera::{project, Camera};+    use crate::tess::stroke;      /// The car's route paint: `#1A73E8` over a white casing, at the phone's authored route     /// width (`maps/.../ui/map/RouteOverlayBuilder.kt`). The old renderer's `12f`/`18f` were
library/map/src/main/rust/src/style/filter.rs
diff --git a/library/map/src/main/rust/src/style/filter.rs b/library/map/src/main/rust/src/style/filter.rsindex 4133b022a4..b4aabcbf17 100644--- a/library/map/src/main/rust/src/style/filter.rs+++ b/library/map/src/main/rust/src/style/filter.rs@@ -169,10 +169,11 @@ impl ToggleStamp {                 return true;             }         }-        if built.poi && self.kinds != *kinds {-            if self.gated.admitted(&self.kinds) != self.gated.admitted(kinds) {-                return true;-            }+        if built.poi+            && self.kinds != *kinds+            && self.gated.admitted(&self.kinds) != self.gated.admitted(kinds)+        {+            return true;         }         false     }
library/map/src/main/rust/src/tess/fill/grouping.rs
diff --git a/library/map/src/main/rust/src/tess/fill/grouping.rs b/library/map/src/main/rust/src/tess/fill/grouping.rsindex 03949b1a68..d004d969d2 100644--- a/library/map/src/main/rust/src/tess/fill/grouping.rs+++ b/library/map/src/main/rust/src/tess/fill/grouping.rs@@ -50,7 +50,7 @@ pub(crate) fn polygons(rings: &[&[(i32, i32)]]) -> Vec<Vec<usize>> {             // The most deeply nested enclosing ring is the one this is a hole of.             let mut closest: Option<(usize, usize)> = None;             for &(ring, votes) in &enclosing[j] {-                if closest.map_or(true, |(held, _)| depth[ring] > depth[held]) {+                if closest.is_none_or(|(held, _)| depth[ring] > depth[held]) {                     closest = Some((ring, votes));                 }             }
library/map/src/main/rust/src/tess/fill/tests.rs
diff --git a/library/map/src/main/rust/src/tess/fill/tests.rs b/library/map/src/main/rust/src/tess/fill/tests.rsindex edfda2de09..da3c218ae9 100644--- a/library/map/src/main/rust/src/tess/fill/tests.rs+++ b/library/map/src/main/rust/src/tess/fill/tests.rs@@ -99,8 +99,10 @@ fn expected_area(rings: &[Vec<(i32, i32)>], extent: u32) -> f64 {     total * scale * scale } -/// Every polygon of every layer of the published tile, as the renderer sees them.-fn real_polygons() -> Vec<(String, u32, Vec<Vec<(i32, i32)>>)> {+/// Every polygon of every layer of the published tile, as the renderer sees them:+/// `(layer name, feature id, polygons as rings of tile-local points)`.+type RealPolygons = Vec<(String, u32, Vec<Vec<(i32, i32)>>)>;+fn real_polygons() -> RealPolygons {     const REAL_TILE: &[u8] = include_bytes!("../../../tests/fixtures/v5ca_z11_tile.mvt");     let tile = tilecodec::mvt::Tile::decode(REAL_TILE).expect("the published tile decodes");     let mut out = Vec::new();@@ -284,7 +286,7 @@ fn two_overlapping_holes_do_not_leave_a_surplus() {      let mut v = Vec::new();     let mut idx = Vec::new();-    tessellate(&vec![outer, a, b], 1000, false, &mut v, &mut idx);+    tessellate(&[outer, a, b], 1000, false, &mut v, &mut idx);      // One 400x400 hole of a 1000x1000 tile cut out, and only one.     assert!(@@ -347,7 +349,7 @@ fn a_hole_crossing_its_exterior_by_one_vertex_is_still_dropped() {      let mut v = Vec::new();     let mut idx = Vec::new();-    tessellate(&vec![outer, crossing], 1000, false, &mut v, &mut idx);+    tessellate(&[outer, crossing], 1000, false, &mut v, &mut idx);      // Dropped, so the fill is exactly the exterior. Keeping it covers 0.8965 instead.     assert!(
library/map/src/main/rust/src/tess/roof/cap.rs
diff --git a/library/map/src/main/rust/src/tess/roof/cap.rs b/library/map/src/main/rust/src/tess/roof/cap.rsindex c0f89d3d2f..5904a1eb4d 100644--- a/library/map/src/main/rust/src/tess/roof/cap.rs+++ b/library/map/src/main/rust/src/tess/roof/cap.rs@@ -37,7 +37,14 @@ pub(crate) fn emit_roof(         ROOF_GABLED | ROOF_HIPPED | ROOF_PYRAMIDAL | ROOF_SKILLION | ROOF_DOME     );     if !pitched || rise <= 0.0 {-        flat_cap(rings, extent, validated, apex, rgba, ground, out_v, out_i);+        flat_cap(+            rings,+            extent,+            validated,+            &FlatCap { apex, rgba, ground },+            out_v,+            out_i,+        );         return;     } @@ -162,6 +169,17 @@ pub(crate) fn emit_roof(     } } +/// How a flat lid is lifted and coloured: its height over the walls, its+/// fill colour, and the ground sampler each corner is draped by.+pub(crate) struct FlatCap<'a> {+    /// The lid's height, in tile-local units.+    pub apex: f32,+    /// The lid's fill colour.+    pub rgba: u32,+    /// Ground height under a tile-local `(x, y)`.+    pub ground: &'a dyn Fn(f32, f32) -> f32,+}+ /// A flat roof lid: the footprint tessellated at the apex, every face pointing straight up. /// /// Each corner is lifted by the ground offset beneath it, so the lid follows the slope like the@@ -172,9 +190,7 @@ pub(crate) fn flat_cap(     rings: &[Vec<(i32, i32)>],     extent: u32,     validated: bool,-    apex: f32,-    rgba: u32,-    ground: &dyn Fn(f32, f32) -> f32,+    cap: &FlatCap<'_>,     out_v: &mut Vec<f32>,     out_i: &mut Vec<u32>, ) {@@ -186,9 +202,9 @@ pub(crate) fn flat_cap(         for (corner, &vi) in tri.iter().enumerate() {             let at = vi as usize * fill::FLOATS_PER_VERTEX;             let (x, y) = (cap_xy[at], cap_xy[at + 1]);-            pts[corner] = [x, y, apex + ground(x, y)];+            pts[corner] = [x, y, cap.apex + (cap.ground)(x, y)];         }-        push_tri(out_v, out_i, pts[0], pts[1], pts[2], [0.0, 0.0, 1.0], rgba);+        push_tri(out_v, out_i, pts[0], pts[1], pts[2], [0.0, 0.0, 1.0], cap.rgba);     } } 
library/map/src/main/rust/src/tess/roof/geom.rs
diff --git a/library/map/src/main/rust/src/tess/roof/geom.rs b/library/map/src/main/rust/src/tess/roof/geom.rsindex cc597d1f39..6073db0f2f 100644--- a/library/map/src/main/rust/src/tess/roof/geom.rs+++ b/library/map/src/main/rust/src/tess/roof/geom.rs@@ -1,7 +1,5 @@ use super::FLOATS_PER_VERTEX; -/// The unit normal- /// The unit normal of the triangle `a, b, c`, or straight up for a degenerate (zero-area) /// triangle so a sliver never emits a NaN normal. pub(crate) fn face_normal(a: [f32; 3], b: [f32; 3], c: [f32; 3]) -> [f32; 3] {
library/map/src/main/rust/src/tess/terrain.rs
diff --git a/library/map/src/main/rust/src/tess/terrain.rs b/library/map/src/main/rust/src/tess/terrain.rsindex 9b527bf942..8e0019f62a 100644--- a/library/map/src/main/rust/src/tess/terrain.rs+++ b/library/map/src/main/rust/src/tess/terrain.rs@@ -157,7 +157,7 @@ pub fn tessellate_masked(     }     // A cell (its four corners) or a skirt segment (its two ends) is drawn only when every sample     // it touches is land. `None` admits everything, so the un-masked path is bit-identical.-    let is_land = |i: usize| land.map_or(true, |m| m.get(i).copied().unwrap_or(false));+    let is_land = |i: usize| land.is_none_or(|m| m.get(i).copied().unwrap_or(false));     // Tile-normalised height per metre; a degenerate (polar) tile with zero width flattens rather     // than dividing by zero, matching how buildings handle the same edge.     let factor = if ground_width_m > 0.0 {
library/map/src/main/rust/src/tess/text_part1.rs
diff --git a/library/map/src/main/rust/src/tess/text_part1.rs b/library/map/src/main/rust/src/tess/text_part1.rsindex 063b6fe94d..251ec7e4b1 100644--- a/library/map/src/main/rust/src/tess/text_part1.rs+++ b/library/map/src/main/rust/src/tess/text_part1.rs@@ -405,6 +405,20 @@ pub fn layout_along_line(     out } +/// The scale a curved label is emitted at, plus the ground it drapes onto.+///+/// Bundled because the three values are always derived together by the+/// caller (frame text size, tile span, DEM sampler) and never varied+/// independently across the glyphs of one run.+pub struct CurvedScale<'a> {+    /// Text size in device px.+    pub text_px: f32,+    /// The tile's span in device px.+    pub tile_span_px: f32,+    /// Ground height under a tile-local `(x, y)`.+    pub ground: &'a dyn Fn(f32, f32) -> f32,+}+ /// Emit two triangles per glyph of a single shaped line laid along a tile-local `centreline`. /// /// The baseline follows the polyline and every glyph is rotated to its local tangent, so a@@ -425,16 +439,14 @@ pub fn emit_curved(     weight: Weight,     line: &ShapedLine,     centreline: &[(f32, f32)],-    text_px: f32,-    tile_span_px: f32,-    ground: &dyn Fn(f32, f32) -> f32,+    scale: &CurvedScale<'_>,     vertices: &mut Vec<f32>,     indices: &mut Vec<u32>, ) {-    if tile_span_px <= 0.0 {+    if scale.tile_span_px <= 0.0 {         return;     }-    let px_per_font_unit = text_px / UP_EM as f32 / tile_span_px;+    let px_per_font_unit = scale.text_px / UP_EM as f32 / scale.tile_span_px;     let placed = layout_along_line(line, centreline, px_per_font_unit);     // The baseline is half a cap-height below the centreline, so the cap box centres on the line.     let cap_half = 0.5 * CAP_HEIGHT_EM * UP_EM as f32 * px_per_font_unit;@@ -463,7 +475,7 @@ pub fn emit_curved(         // with the ground under tilt instead of standing up. The anchor height is sampled at the         // pen per glyph — the four corners sit within pixels of it — so street names ride the         // same relief their road drapes onto rather than sinking into hillsides.-        let pen_h = ground(cg.pen.0, cg.pen.1);+        let pen_h = (scale.ground)(cg.pen.0, cg.pen.1);         vertices.extend_from_slice(&[x0, y0, uv.u0, uv.v0, x0, y0, pen_h]);         vertices.extend_from_slice(&[x1, y1, uv.u1, uv.v0, x1, y1, pen_h]);         vertices.extend_from_slice(&[x2, y2, uv.u1, uv.v1, x2, y2, pen_h]);
library/map/src/main/rust/src/tess/text_part3.rs
diff --git a/library/map/src/main/rust/src/tess/text_part3.rs b/library/map/src/main/rust/src/tess/text_part3.rsindex aef4b3a6c4..d906d90e8c 100644--- a/library/map/src/main/rust/src/tess/text_part3.rs+++ b/library/map/src/main/rust/src/tess/text_part3.rs@@ -214,7 +214,19 @@         let ppfu = 24.0 / UP_EM as f32 / 512.0;         let placed = layout_along_line(&line, &centreline, ppfu);         let (mut v, mut idx) = (Vec::new(), Vec::new());-        emit_curved(&atlas, Weight::Regular, &line, &centreline, 24.0, 512.0, &|_, _| 0.0, &mut v, &mut idx);+        emit_curved(+            &atlas,+            Weight::Regular,+            &line,+            &centreline,+            &CurvedScale {+                text_px: 24.0,+                tile_span_px: 512.0,+                ground: &|_, _| 0.0,+            },+            &mut v,+            &mut idx,+        );         // A glyph with no ink (a space) draws no quad, so bound by placed glyphs that have UVs.         let drawable = placed.iter().filter(|c| atlas.uv(Weight::Regular, c.glyph.ch).is_some()).count();         assert_eq!(idx.len(), drawable * 6, "six indices per drawable glyph");
library/map/src/main/rust/src/tile/arrow/tests_part2.rs
diff --git a/library/map/src/main/rust/src/tile/arrow/tests_part2.rs b/library/map/src/main/rust/src/tile/arrow/tests_part2.rsindex 0b49011eec..3231011211 100644--- a/library/map/src/main/rust/src/tile/arrow/tests_part2.rs+++ b/library/map/src/main/rust/src/tile/arrow/tests_part2.rs@@ -1,7 +1,6 @@-use super::glyph::{HEAD_HALF_WIDTH, SHAFT_HALF_WIDTH, TAIL_X}; use super::*; use tilecodec::mamaps::body::{-    LaneTurns, LANE_LEFT, LANE_REVERSE, LANE_RIGHT, LANE_SLIGHT_LEFT, LANE_THROUGH,+    LaneTurns, LANE_LEFT, LANE_RIGHT, LANE_THROUGH, };  /// The two directions' arrows do not land on top of each other, which is what drew as a single
library/map/src/main/rust/src/tile/geometry/mod.rs
diff --git a/library/map/src/main/rust/src/tile/geometry/mod.rs b/library/map/src/main/rust/src/tile/geometry/mod.rsindex bd37e09e96..b0516fae79 100644--- a/library/map/src/main/rust/src/tile/geometry/mod.rs+++ b/library/map/src/main/rust/src/tile/geometry/mod.rs@@ -63,4 +63,8 @@ pub use mesh::{     labels_by_layer, BuildingMesh, CarriagewayMesh, LayerMesh, RegionMesh, ShapedLabel, TerrainMesh,     TileMesh, TrafficMesh, ROAD_LANE_MIN_ZOOM, TRAFFIC_MIN_ZOOM, };+// Only the Android Vulkan renderer samples ground height through this+// re-export; host code reaches `terrain` directly, so gate it to avoid a+// dead re-export on host builds.+#[cfg(target_os = "android")] pub(crate) use terrain::{sample_ground_metres, tile_ground_width_m};
library/map/src/main/rust/src/tile/geometry/tests.rs
diff --git a/library/map/src/main/rust/src/tile/geometry/tests.rs b/library/map/src/main/rust/src/tile/geometry/tests.rsindex 6b72bd6519..f986397488 100644--- a/library/map/src/main/rust/src/tile/geometry/tests.rs+++ b/library/map/src/main/rust/src/tile/geometry/tests.rs@@ -1,7 +1,6 @@ use super::build::{build, build_toggled}; use super::mesh::{LayerMesh, TileMesh}; use crate::style;-use crate::style::paint::Ramp; use crate::style::{KindFilter, Layer, LayerKind, LayerToggles}; use crate::tess::{fill, stroke}; use tilecodec::mamaps::body::{@@ -108,37 +107,37 @@ fn the_real_tile_produces_geometry_for_the_layers_it_has_data_in() {     // The fixture body carries one kind-less `landtype` mainland, one `roads`     // LineString of kind = major_road, and two `lake` polygons on `landtype`.     let layers = style::layers();-    let mesh = build(&real(), &layers, 14, 339, 770, false);+    let mesh = build(&real(), layers, 14, 339, 770, false);      assert!(-        mesh_for(&mesh, &layers, "earth").is_some(),+        mesh_for(&mesh, layers, "earth").is_some(),         "the earth polygon tessellates"     );     assert!(-        mesh_for(&mesh, &layers, "water").is_some(),+        mesh_for(&mesh, layers, "water").is_some(),         "both water polygons tessellate"     );     assert!(-        mesh_for(&mesh, &layers, "roads-major").is_some(),+        mesh_for(&mesh, layers, "roads-major").is_some(),         "the major_road strokes"     );     assert!(-        mesh_for(&mesh, &layers, "roads-major-casing").is_some(),+        mesh_for(&mesh, layers, "roads-major-casing").is_some(),         "and so does its casing"     );      // Layers the tile has no data for produce no mesh at all, rather than an empty     // one that would still cost a draw.     assert!(-        mesh_for(&mesh, &layers, "buildings").is_none(),+        mesh_for(&mesh, layers, "buildings").is_none(),         "no buildings layer here"     );     assert!(-        mesh_for(&mesh, &layers, "roads-highway").is_none(),+        mesh_for(&mesh, layers, "roads-highway").is_none(),         "the road is a major_road"     );     assert!(-        mesh_for(&mesh, &layers, "landuse_park:national_park").is_none(),+        mesh_for(&mesh, layers, "landuse_park:national_park").is_none(),         "no landuse layer",     ); }@@ -219,7 +218,7 @@ fn major_road_at_min_zoom(min_zoom: u8) -> Layer { #[test] fn every_mesh_is_well_formed() {     let layers = style::layers();-    let mesh = build(&real(), &layers, 11, 339, 770, false);+    let mesh = build(&real(), layers, 11, 339, 770, false);     assert!(!mesh.meshes.is_empty());     for m in &mesh.meshes {         let id = &layers[m.layer_index].id;@@ -250,7 +249,7 @@ fn tessellated_output_is_within_the_bounds_the_shaders_assume() {     // pixels for the dash pattern. A violation of any of those renders a recognisable     // map that is badly wrong, which is exactly the failure this pins down.     let layers = style::layers();-    let mesh = build(&real(), &layers, 11, 339, 770, false);+    let mesh = build(&real(), layers, 11, 339, 770, false);     assert!(!mesh.meshes.is_empty());      let mut worst_pos = 0.0f32;@@ -318,7 +317,7 @@ fn positions_are_tile_normalised() {     // The clip transform assumes 0..1 within the tile. Clipped geometry overspills     // the edges a little, which is why the bound is generous rather than exact.     let layers = style::layers();-    let mesh = build(&real(), &layers, 11, 339, 770, false);+    let mesh = build(&real(), layers, 11, 339, 770, false);     for m in &mesh.meshes {         let stride = match m.kind {             LayerKind::Fill => fill::FLOATS_PER_VERTEX,@@ -343,12 +342,12 @@ fn positions_are_tile_normalised() { #[test] fn a_layer_outside_its_zoom_range_is_skipped() {     let layers = style::layers();-    let low = build(&real(), &layers, 11, 339, 770, false);+    let low = build(&real(), layers, 11, 339, 770, false);     // buildings is min_zoom 14, and roads-minor is 13; the tile's road is a     // major_road anyway.-    assert!(mesh_for(&low, &layers, "roads-minor").is_none());+    assert!(mesh_for(&low, layers, "roads-minor").is_none());     assert!(-        mesh_for(&low, &layers, "earth").is_some(),+        mesh_for(&low, layers, "earth").is_some(),         "earth draws at every zoom"     ); }@@ -356,9 +355,9 @@ fn a_layer_outside_its_zoom_range_is_skipped() { #[test] fn a_casing_produces_twice_the_vertices_of_a_plain_stroke() {     let layers = style::layers();-    let mesh = build(&real(), &layers, 11, 339, 770, false);-    let plain = mesh_for(&mesh, &layers, "roads-major").expect("plain");-    let casing = mesh_for(&mesh, &layers, "roads-major-casing").expect("casing");+    let mesh = build(&real(), layers, 11, 339, 770, false);+    let plain = mesh_for(&mesh, layers, "roads-major").expect("plain");+    let casing = mesh_for(&mesh, layers, "roads-major-casing").expect("casing");     assert_eq!(         plain.vertices.len() * 2,         casing.vertices.len(),@@ -370,7 +369,7 @@ fn a_casing_produces_twice_the_vertices_of_a_plain_stroke() { #[test] fn an_empty_tile_produces_no_meshes() {     let layers = style::layers();-    let mesh = build(&Body::new(4096), &layers, 11, 0, 0, false);+    let mesh = build(&Body::new(4096), layers, 11, 0, 0, false);     assert!(mesh.meshes.is_empty()); } 
library/map/src/main/rust/src/tile/geometry/tests_drape.rs
diff --git a/library/map/src/main/rust/src/tile/geometry/tests_drape.rs b/library/map/src/main/rust/src/tile/geometry/tests_drape.rsindex 2c9a97ecae..db3b1aa40f 100644--- a/library/map/src/main/rust/src/tile/geometry/tests_drape.rs+++ b/library/map/src/main/rust/src/tile/geometry/tests_drape.rs@@ -223,7 +223,7 @@ fn a_degenerate_heightmap_keeps_the_flat_earth_fill() {         dim: 1,         samples: vec![32768],     });-    let mesh = build(&body, &layers, 11, 339, 770, false);+    let mesh = build(&body, layers, 11, 339, 770, false);     assert!(         mesh.terrain.indices.is_empty(),         "a degenerate grid tessellates to nothing"
library/map/src/main/rust/src/tile/geometry/tests_extra2.rs
diff --git a/library/map/src/main/rust/src/tile/geometry/tests_extra2.rs b/library/map/src/main/rust/src/tile/geometry/tests_extra2.rsindex a3fc51d214..7e525d0331 100644--- a/library/map/src/main/rust/src/tile/geometry/tests_extra2.rs+++ b/library/map/src/main/rust/src/tile/geometry/tests_extra2.rs@@ -1,8 +1,7 @@ use super::build::{build, build_toggled};-use super::mesh::{LayerMesh, TileMesh};+use super::mesh::LayerMesh; use crate::style;-use crate::style::paint::Ramp;-use crate::style::{KindFilter, Layer, LayerKind, LayerToggles};+use crate::style::{KindFilter, Layer, LayerToggles}; use crate::tess::ribbon; use tilecodec::mamaps::body::{     Body, Feature, Layer as BodyLayer, Part, GEOM_LINE, GEOM_POLYGON, NAME_NONE, WINDING_OUTER,@@ -84,10 +83,6 @@ fn real() -> Body {     body } -fn mesh_for<'a>(mesh: &'a TileMesh, layers: &[Layer], id: &str) -> Option<&'a LayerMesh> {-    mesh.meshes.iter().find(|m| layers[m.layer_index].id == id)-}- /// A body of straight roads, one per `(lane_count, oneway)` entry, on the `roads` layer. fn carriageway_body(roads: &[(u8, bool)]) -> Body {     use tilecodec::mamaps::body::{@@ -410,7 +405,7 @@ fn transit_lines_of_one_colour_split_again_on_their_corridor_ordinal() { #[test] fn a_layer_whose_features_carry_no_colour_still_emits_one_mesh() {     let layers = style::layers();-    let mesh = build(&real(), &layers, 11, 339, 770, false);+    let mesh = build(&real(), layers, 11, 339, 770, false);     for m in &mesh.meshes {         assert_eq!(             m.color_override, None,
library/map/src/main/rust/src/tile/geometry/tests_extra3.rs
diff --git a/library/map/src/main/rust/src/tile/geometry/tests_extra3.rs b/library/map/src/main/rust/src/tile/geometry/tests_extra3.rsindex 6195472307..0a93a01565 100644--- a/library/map/src/main/rust/src/tile/geometry/tests_extra3.rs+++ b/library/map/src/main/rust/src/tile/geometry/tests_extra3.rs@@ -4,7 +4,7 @@ use crate::style; use crate::style::{KindFilter, Layer, LayerToggles}; use crate::tess::roof; use tilecodec::mamaps::body::{-    Body, Feature, Layer as BodyLayer, Part, GEOM_LINE, GEOM_POLYGON, NAME_NONE, WINDING_OUTER,+    Body, GEOM_LINE, GEOM_POLYGON, }; use tilecodec::mamaps::dict::LAYER_TRAFFIC; @@ -314,7 +314,7 @@ fn a_building_extrudes_into_a_3d_mesh_not_a_flat_fill() {         ..Default::default()     }));     let layers = style::layers();-    let mesh = build(&body, &layers, 14, 0, 8192, false);+    let mesh = build(&body, layers, 14, 0, 8192, false);      assert!(         !mesh.buildings.indices.is_empty(),@@ -332,7 +332,7 @@ fn a_building_extrudes_into_a_3d_mesh_not_a_flat_fill() {     );     // Buildings draw in their own depth pass, so they must NOT also appear as a flat fill mesh.     assert!(-        mesh_for(&mesh, &layers, "buildings").is_none(),+        mesh_for(&mesh, layers, "buildings").is_none(),         "a building must not double up as a flat fill",     ); @@ -358,7 +358,7 @@ fn a_taller_building_reaches_higher() {             height: 200,             ..Default::default()         })),-        &layers,+        layers,         14,         0,         8192,@@ -369,7 +369,7 @@ fn a_taller_building_reaches_higher() {             height: 600,             ..Default::default()         })),-        &layers,+        layers,         14,         0,         8192,@@ -389,7 +389,7 @@ fn a_taller_building_reaches_higher() { fn a_building_with_no_side_table_still_extrudes_a_default_box() {     // A layer with no building table reads back default attrs, which extrude at the default     // height rather than nothing — an unattributed building is still a building.-    let mesh = build(&building_body(None), &style::layers(), 14, 0, 8192, false);+    let mesh = build(&building_body(None), style::layers(), 14, 0, 8192, false);     assert!(         !mesh.buildings.indices.is_empty(),         "a default building still extrudes"@@ -410,7 +410,7 @@ fn buildings_are_not_extruded_far_below_their_zoom() {             height: 300,             ..Default::default()         })),-        &style::layers(),+        style::layers(),         5,         0,         8192,
library/map/src/main/rust/src/tile/geometry/tests_extra4.rs
diff --git a/library/map/src/main/rust/src/tile/geometry/tests_extra4.rs b/library/map/src/main/rust/src/tile/geometry/tests_extra4.rsindex d4af9ee58b..c7166efaa8 100644--- a/library/map/src/main/rust/src/tile/geometry/tests_extra4.rs+++ b/library/map/src/main/rust/src/tile/geometry/tests_extra4.rs@@ -137,7 +137,7 @@ fn an_unnamed_road_line_shapes_no_label() {     use tilecodec::mamaps::body::NAME_NONE;     let mut body = named_road_body("ignored", &[(200, 2048), (3800, 2048)]);     body.layers[0].features[0].name_idx = NAME_NONE;-    let mesh = build(&body, &vec![roads_label_layer()], 14, 0, 8192, false);+    let mesh = build(&body, &[roads_label_layer()], 14, 0, 8192, false);     assert!(         mesh.labels.is_empty(),         "an unnamed road line shapes nothing"@@ -239,7 +239,7 @@ fn a_building_over_a_hill_gets_its_base_lifted() {     );     // The footprint's far corner (1000/4096 ≈ 0.244) lands at grid 1.95, inside the plateau;     // widen the plateau check by asserting the lift rather than the corner math.-    let mesh = build(&body, &crate::style::layers(), z, 0, y, false);+    let mesh = build(&body, crate::style::layers(), z, 0, y, false);     assert!(         !mesh.buildings.indices.is_empty(),         "the building must still extrude"@@ -251,7 +251,7 @@ fn a_building_over_a_hill_gets_its_base_lifted() {         "the skirted wall base rides the hill at (metres - skirt)/ground_width: {got} vs {want}",     );     body.heightmap = None;-    let flat = build(&body, &crate::style::layers(), z, 0, y, false);+    let flat = build(&body, crate::style::layers(), z, 0, y, false);     assert!(         min_building_z(&flat).abs() < 1e-6,         "without the hill the same building starts at z 0",@@ -276,7 +276,7 @@ fn no_heightmap_leaves_structural_heights_bit_exact() {         }),         None,     );-    let mesh = build(&body, &crate::style::layers(), z, 0, y, false);+    let mesh = build(&body, crate::style::layers(), z, 0, y, false);     assert!(!mesh.buildings.indices.is_empty());     // 30 m total, 10 m of roof: base 0, eaves 20 m, ridge 30 m, tile-normalised.     let structural = [0.0f32, (20.0 * factor) as f32, (30.0 * factor) as f32].map(f32::to_bits);@@ -288,7 +288,7 @@ fn no_heightmap_leaves_structural_heights_bit_exact() {         );     }     // And rebuilding is deterministic, so the mesh is a pure function of tile + style.-    let again = build(&body, &crate::style::layers(), z, 0, y, false);+    let again = build(&body, crate::style::layers(), z, 0, y, false);     assert_eq!(mesh.buildings.vertices, again.buildings.vertices);     assert_eq!(mesh.buildings.indices, again.buildings.indices); }@@ -311,7 +311,7 @@ fn a_building_in_a_depression_sits_below_zero() {             |c, r| if c < 3 && r < 3 { -100 } else { 0 },         )),     );-    let mesh = build(&body, &crate::style::layers(), z, 0, y, false);+    let mesh = build(&body, crate::style::layers(), z, 0, y, false);     assert!(!mesh.buildings.indices.is_empty());     let got = min_building_z(&mesh);     assert!(got < 0.0, "a below-sea base dips below z 0, got {got}");@@ -428,7 +428,7 @@ fn a_building_on_saddle_terrain_seats_on_the_fold_and_skirts_below() {         }),         saddle,     );-    let mesh = build(&body, &crate::style::layers(), z, 0, y, false);+    let mesh = build(&body, crate::style::layers(), z, 0, y, false);     assert!(         !mesh.buildings.indices.is_empty(),         "the building must still extrude"
library/map/src/main/rust/src/tile/geometry/tests_extra5.rs
diff --git a/library/map/src/main/rust/src/tile/geometry/tests_extra5.rs b/library/map/src/main/rust/src/tile/geometry/tests_extra5.rsindex 439b68fc63..ae7fafccd0 100644--- a/library/map/src/main/rust/src/tile/geometry/tests_extra5.rs+++ b/library/map/src/main/rust/src/tile/geometry/tests_extra5.rs@@ -150,11 +150,11 @@ fn turn_arrows_come_from_the_turn_table_at_high_zoom() {     )];      // Below the gate: no arrows built.-    assert!(build(&body, &style::layers(), 11, 0, 0, false)+    assert!(build(&body, style::layers(), 11, 0, 0, false)         .arrows         .is_empty()); -    let mesh = build(&body, &style::layers(), 16, 0, 0, false);+    let mesh = build(&body, style::layers(), 16, 0, 0, false);     assert_eq!(mesh.arrows.len(), 2, "one arrow per marked forward lane");     assert!(         mesh.arrows.iter().all(|a| a.angle.abs() < 1e-4),
library/map/src/main/rust/src/tile/geometry/tests_extra7.rs
diff --git a/library/map/src/main/rust/src/tile/geometry/tests_extra7.rs b/library/map/src/main/rust/src/tile/geometry/tests_extra7.rsindex 27ee5c7a22..078fc0c3a5 100644--- a/library/map/src/main/rust/src/tile/geometry/tests_extra7.rs+++ b/library/map/src/main/rust/src/tile/geometry/tests_extra7.rs@@ -92,7 +92,7 @@ fn a_heightmap_tile_builds_terrain_and_keeps_the_flat_earth_fill() {     let layers = style::layers();     let mut body = real();     body.heightmap = Some(heightmap(9, |c, r| (c as i32 + r as i32) * 20));-    let mesh = build(&body, &layers, 11, 339, 770, false);+    let mesh = build(&body, layers, 11, 339, 770, false);      assert!(         !mesh.terrain.indices.is_empty(),@@ -109,11 +109,11 @@ fn a_heightmap_tile_builds_terrain_and_keeps_the_flat_earth_fill() {         "terrain vertices are whole",     );     assert!(-        mesh_for(&mesh, &layers, "earth").is_some(),+        mesh_for(&mesh, layers, "earth").is_some(),         "the flat earth fill stays as backstop under the terrain grid",     );     assert!(-        mesh_for(&mesh, &layers, "water").is_some(),+        mesh_for(&mesh, layers, "water").is_some(),         "water still draws flat over terrain"     ); }@@ -123,13 +123,13 @@ fn a_tile_without_a_heightmap_stays_flat() {     // The no-DEM case (ocean, off-coverage): no terrain grid, and the flat earth fill remains     // exactly as it always was.     let layers = style::layers();-    let mesh = build(&real(), &layers, 11, 339, 770, false);+    let mesh = build(&real(), layers, 11, 339, 770, false);     assert!(         mesh.terrain.indices.is_empty(),         "a tile with no heightmap builds no terrain"     );     assert!(-        mesh_for(&mesh, &layers, "earth").is_some(),+        mesh_for(&mesh, layers, "earth").is_some(),         "and keeps its flat earth fill"     ); }@@ -168,13 +168,13 @@ fn open_sea_with_a_heightmap_builds_no_terrain() {     body.layers.push(water);     // A flat sea-level DEM, exactly what coastal tiles carry over their water half.     body.heightmap = Some(heightmap(9, |_, _| 0));-    let mesh = build(&body, &layers, 4, 2, 5, false);+    let mesh = build(&body, layers, 4, 2, 5, false);     assert!(         mesh.terrain.indices.is_empty(),         "open sea builds no relief grid, or shaded earth covers the ocean"     );     assert!(-        mesh_for(&mesh, &layers, "water").is_some(),+        mesh_for(&mesh, layers, "water").is_some(),         "the water fill still draws flat over the clear"     ); }@@ -192,7 +192,7 @@ fn terrain_height_is_normalised_from_the_dem() {         5,         |c, r| if c == 2 && r == 2 { peak_m } else { 0 },     ));-    let mesh = build(&body, &layers, z, 339, y, false);+    let mesh = build(&body, layers, z, 339, y, false);      let ground = tile_ground_width_m(z, y);     let max_z = mesh@@ -252,7 +252,7 @@ fn a_coastal_tile_withholds_terrain_from_its_water_half() {     body.layers.push(landtype);     // Hilly DEM: relief must appear west, never east.     body.heightmap = Some(heightmap(9, |c, r| (c as i32 + r as i32) * 20));-    let mesh = build(&body, &layers, 11, 339, 770, false);+    let mesh = build(&body, layers, 11, 339, 770, false);     assert!(         !mesh.terrain.indices.is_empty(),         "the land half still builds relief"@@ -268,7 +268,7 @@ fn a_coastal_tile_withholds_terrain_from_its_water_half() {         }     }     assert!(-        mesh_for(&mesh, &layers, "water").is_some(),+        mesh_for(&mesh, layers, "water").is_some(),         "the water fill still draws flat over the withheld grid"     ); }@@ -305,10 +305,10 @@ fn a_marine_sanctuary_over_open_water_draws_no_land_fill() {     });     landtype.coords = vec![(0, 0), (4096, 0), (4096, 4096), (0, 4096)];     body.layers.push(landtype);-    let mesh = build(&body, &layers, 12, 659, 1595, false);+    let mesh = build(&body, layers, 12, 659, 1595, false);     for id in ["earth", "landcover"] {         assert!(-            mesh_for(&mesh, &layers, id).is_none(),+            mesh_for(&mesh, layers, id).is_none(),             "{id} must not tessellate the sanctuary — it is open water",         );     }
library/map/src/main/rust/src/tile/placement.rs
diff --git a/library/map/src/main/rust/src/tile/placement.rs b/library/map/src/main/rust/src/tile/placement.rsindex 78f4656551..665f0973f9 100644--- a/library/map/src/main/rust/src/tile/placement.rs+++ b/library/map/src/main/rust/src/tile/placement.rs@@ -255,7 +255,7 @@ pub struct BoxInputs { /// Returns `None` when the point is on or behind the eye (`w <= 0`): there is no screen position /// to collide at, so the label cannot be a candidate. Callers skip the label (point path) or the /// glyph (curved path) — a box for an unprojectable label is unrepresentable rather than garbage.-/// The `!(w > 0.0)` form also catches NaN, which would otherwise build a box that collides with+/// The `partial_cmp` form also catches NaN, which would otherwise build a box that collides with /// nothing and always draws. pub fn project_to_screen(     tile_clip: [f32; 16],@@ -265,7 +265,10 @@ pub fn project_to_screen(     let cx = tile_clip[0] * point.0 + tile_clip[4] * point.1 + tile_clip[12];     let cy = tile_clip[1] * point.0 + tile_clip[5] * point.1 + tile_clip[13];     let w = tile_clip[3] * point.0 + tile_clip[7] * point.1 + tile_clip[15];-    if !(w > 0.0) {+    if !matches!(+        w.partial_cmp(&0.0),+        Some(std::cmp::Ordering::Greater)+    ) {         return None;     }     Some((
library/map/src/main/rust/src/tile/placement_globe.rs
diff --git a/library/map/src/main/rust/src/tile/placement_globe.rs b/library/map/src/main/rust/src/tile/placement_globe.rsindex 0d3a67add7..ae49551bb8 100644--- a/library/map/src/main/rust/src/tile/placement_globe.rs+++ b/library/map/src/main/rust/src/tile/placement_globe.rs@@ -1,14 +1,14 @@-/// Globe-aware screen projection for label placement: lon/lat through the-/// orthographic sphere instead of the flat tile matrix.-///-/// Split from `placement.rs` (file-length limit). The flat `project_to_screen`-/// feeds a tile-local point through the tile's clip matrix; on the globe the-/// matrix bends (a 4x4 cannot bend a sphere), so labels placed through it land-/// in flat positions while the basemap under them draws bent — the scattered-/// text of the broken globe. These helpers project through the same-/// `globe_point` basis the vertex shaders and the CPU anchor use, with the-/// same screen convention (`halfH - y`, north up) and the same far-side cull-/// far-side cull (z < 0 draws nothing).+// Globe-aware screen projection for label placement: lon/lat through the+// orthographic sphere instead of the flat tile matrix.+//+// Split from `placement.rs` (file-length limit). The flat `project_to_screen`+// feeds a tile-local point through the tile's clip matrix; on the globe the+// matrix bends (a 4x4 cannot bend a sphere), so labels placed through it land+// in flat positions while the basemap under them draws bent — the scattered+// text of the broken globe. These helpers project through the same+// `globe_point` basis the vertex shaders and the CPU anchor use, with the+// same screen convention (`halfH - y`, north up) and the same far-side cull+// (z < 0 draws nothing). // // No imports: this file is `include!`d into `placement.rs`, so `Anchor`, // `BoxInputs` and `Obb` (and the whole parent scope) are already in scope.@@ -44,6 +44,21 @@ pub fn tile_anchor_lonlat(tz: u8, tx: u32, ty: u32, anchor: (f32, f32)) -> (f64,     (lon, lat) } +/// Which tile a globe-projected point lives in.+///+/// Bundled because the globe helpers always need the whole tile address to+/// turn a tile-local point into lon/lat; the coordinates are never passed+/// independently.+#[derive(Clone, Copy)]+pub struct TileRef {+    /// Zoom level.+    pub z: u8,+    /// Tile column.+    pub x: u32,+    /// Tile row.+    pub y: u32,+}+ /// The screen box a label would occupy on the globe if drawn at `anchor`. /// /// Same box construction as [`super::anchored_rect`] (text block + icon union,@@ -51,15 +66,13 @@ pub fn tile_anchor_lonlat(tz: u8, tx: u32, ty: u32, anchor: (f32, f32)) -> (f64, /// than the flat matrix projection. Returns `None` far-side. pub fn globe_anchored_rect(     camera: &crate::camera::Camera,-    tz: u8,-    tx: u32,-    ty: u32,+    tile: TileRef,     point: (f32, f32),     extent_wh: (u32, u32),     inputs: &BoxInputs,     anchor: Anchor, ) -> Option<(f32, f32, f32, f32)> {-    let (lon, lat) = tile_anchor_lonlat(tz, tx, ty, point);+    let (lon, lat) = tile_anchor_lonlat(tile.z, tile.x, tile.y, point);     let (sx, sy) = globe_to_screen(camera, lon, lat, extent_wh)?;      let w = inputs.text_px * inputs.advance / crate::tile::glyph::UP_EM as f32;@@ -96,9 +109,7 @@ pub fn globe_anchored_rect( /// the flat linear part, exactly as the flat path does under tilt. pub fn globe_curved_boxes(     camera: &crate::camera::Camera,-    tz: u8,-    tx: u32,-    ty: u32,+    tile: TileRef,     placements: &[crate::tess::text::CurvedGlyph],     tile_clip: [f32; 16],     extent_wh: (u32, u32),@@ -114,7 +125,7 @@ pub fn globe_curved_boxes(         if advance_px <= 0.0 {             continue;         }-        let (lon, lat) = tile_anchor_lonlat(tz, tx, ty, cg.pen);+        let (lon, lat) = tile_anchor_lonlat(tile.z, tile.x, tile.y, cg.pen);         let Some((sx, sy)) = globe_to_screen(camera, lon, lat, extent_wh) else { continue };         // Screen-space tangent through the flat linear part (glyph-scale: the         // sphere bend varies negligibly across one glyph).
library/map/src/main/rust/src/tile/placement_grid.rs
diff --git a/library/map/src/main/rust/src/tile/placement_grid.rs b/library/map/src/main/rust/src/tile/placement_grid.rsindex 9981d37d1c..5ccb1c21c3 100644--- a/library/map/src/main/rust/src/tile/placement_grid.rs+++ b/library/map/src/main/rust/src/tile/placement_grid.rs@@ -61,7 +61,10 @@ pub fn place_segmented(candidates: &[SegmentedCandidate]) -> Vec<Placed> {         }     }     let mut cell: f32 = max_e * 2.0;-    if !(cell >= 1.0) {+    if !matches!(+        cell.partial_cmp(&1.0),+        Some(std::cmp::Ordering::Greater | std::cmp::Ordering::Equal)+    ) {         cell = 1.0;     }     let mut grid: HashMap<(i32, i32), Vec<usize>> = HashMap::new();
library/map/src/main/rust/src/tile/select/tests_part3.rs
diff --git a/library/map/src/main/rust/src/tile/select/tests_part3.rs b/library/map/src/main/rust/src/tile/select/tests_part3.rsindex 1b903ad5a6..d40949fb91 100644--- a/library/map/src/main/rust/src/tile/select/tests_part3.rs+++ b/library/map/src/main/rust/src/tile/select/tests_part3.rs@@ -170,7 +170,7 @@ fn eviction_spends_the_byte_budget_on_descendants_last() {         (2, 30, 8 * MIB),         (1, 20, 4 * MIB),         (0, 10, 40 * MIB),-        (2, 31, 1 * MIB),+        (2, 31, MIB),     ];     let doomed = evict(&mut ranked, 64, 48 * MIB);     assert_eq!(doomed, vec![30]);
library/map/src/main/rust/src/tile/source/caching.rs
diff --git a/library/map/src/main/rust/src/tile/source/caching.rs b/library/map/src/main/rust/src/tile/source/caching.rsindex 1c6e8b81c4..0c7a5b5c46 100644--- a/library/map/src/main/rust/src/tile/source/caching.rs+++ b/library/map/src/main/rust/src/tile/source/caching.rs@@ -97,10 +97,7 @@ impl<F: RangeFetcher> CachingRangeReader<F> {             }         } -        let response = match self.fetcher.fetch(&self.url, &range) {-            Ok(r) => r,-            Err(e) => return Err(e),-        };+        let response = self.fetcher.fetch(&self.url, &range)?;          if !(200..300).contains(&response.status) {             return err(format!(
library/map/src/main/rust/src/tile/source/overlay.rs
diff --git a/library/map/src/main/rust/src/tile/source/overlay.rs b/library/map/src/main/rust/src/tile/source/overlay.rsindex d86c0a976f..b7c5f533b7 100644--- a/library/map/src/main/rust/src/tile/source/overlay.rs+++ b/library/map/src/main/rust/src/tile/source/overlay.rs@@ -16,7 +16,7 @@ use std::path::{Path, PathBuf}; use std::sync::Arc; -use tilecodec::mamaps::read::{LeafCache, MamapsArchive, OverlayArchive, TileSource};+use tilecodec::mamaps::read::{LeafCache, MamapsArchive, OverlayArchive};  use super::file::FileRangeReader; @@ -40,7 +40,7 @@ pub struct Discovered { pub fn discover(base_path: &Path, base_leaves: Arc<LeafCache>) -> Option<Discovered> {     let dir = base_path.parent()?;     let overlays = dir.join("overlays");-    let text = std::fs::read_to_string(overlays.join("manifest.json")).ok()?;+    let text = std::fs::read_to_string(manifest_path(base_path)).ok()?;     let manifest: serde_json::Value = serde_json::from_str(&text).ok()?;     let seq = manifest.get("overlay_seq")?.as_u64()?;     let base_pin = manifest.get("base")?;@@ -112,7 +112,7 @@ pub fn discover(base_path: &Path, base_leaves: Arc<LeafCache>) -> Option<Discove  /// Read the base file's own header `build_id` (bytes 16..24 LE) without mapping it. fn read_build_id(path: &Path) -> Option<u64> {-    use std::io::{Read as _, Seek as _};+    use std::io::Read as _;     let mut file = std::fs::File::open(path).ok()?;     let mut head = [0u8; 128];     file.read_exact(&mut head).ok()?;
library/map/src/main/rust/src/tile/source/tests.rs
diff --git a/library/map/src/main/rust/src/tile/source/tests.rs b/library/map/src/main/rust/src/tile/source/tests.rsindex ff2f997008..42bb9f5676 100644--- a/library/map/src/main/rust/src/tile/source/tests.rs+++ b/library/map/src/main/rust/src/tile/source/tests.rs@@ -12,10 +12,8 @@ use tilecodec::stream::RangeReader; #[test] fn the_first_failure_backs_off_rather_than_retrying_at_once() {     assert_eq!(retry_delay_ms(1), RETRY_BASE_MS);-    assert!(-        RETRY_BASE_MS > 16,-        "a delay under one frame would not be a backoff at all"-    );+    // A delay under one frame would not be a backoff at all.+    const { assert!(RETRY_BASE_MS > 16) }; }  /// Consecutive failures double, so an unreachable archive settles to a poll.
library/map/src/main/rust/src/tile/symbol/emit.rs
diff --git a/library/map/src/main/rust/src/tile/symbol/emit.rs b/library/map/src/main/rust/src/tile/symbol/emit.rsindex f28af760ad..52159200c4 100644--- a/library/map/src/main/rust/src/tile/symbol/emit.rs+++ b/library/map/src/main/rust/src/tile/symbol/emit.rs@@ -56,9 +56,11 @@ pub fn emit_label(             label.weight,             line,             centreline,-            text_px,-            tile_span_px,-            ground,+            &text::CurvedScale {+                text_px,+                tile_span_px,+                ground,+            },             vertices,             indices,         );
library/map/src/main/rust/src/tile/symbol/tests.rs
diff --git a/library/map/src/main/rust/src/tile/symbol/tests.rs b/library/map/src/main/rust/src/tile/symbol/tests.rsindex 35c285cd3b..af22331b47 100644--- a/library/map/src/main/rust/src/tile/symbol/tests.rs+++ b/library/map/src/main/rust/src/tile/symbol/tests.rs@@ -1,6 +1,5 @@ use super::*; use crate::style::Layer;-use crate::tile::geometry::ShapedLabel; use crate::tile::glyph::fonts_staged; use tilecodec::mamaps::body::{Body, Feature}; 
library/map/src/main/rust/src/tile/symbol/tests_extra.rs
diff --git a/library/map/src/main/rust/src/tile/symbol/tests_extra.rs b/library/map/src/main/rust/src/tile/symbol/tests_extra.rsindex 4747614cee..84adf8023a 100644--- a/library/map/src/main/rust/src/tile/symbol/tests_extra.rs+++ b/library/map/src/main/rust/src/tile/symbol/tests_extra.rs@@ -195,7 +195,7 @@ fn a_billboarded_icon_stays_the_same_screen_size_at_any_pitch() {             sprite,             false,             1.0,-            cam.tile_span_px(z) as f32,+            cam.tile_span_px(z),             (1.0, 0.0),             &|_, _| 0.0,             &mut vertices,@@ -239,7 +239,7 @@ fn a_billboarded_icon_stays_pinned_to_its_ground_point() {         test_sprite(),         false,         1.0,-        cam.tile_span_px(z) as f32,+        cam.tile_span_px(z),         (1.0, 0.0),         &|_, _| 0.0,         &mut vertices,
library/map/src/main/rust/src/timing.rs
diff --git a/library/map/src/main/rust/src/timing.rs b/library/map/src/main/rust/src/timing.rsindex 25c4d0aba5..a4e6a417f0 100644--- a/library/map/src/main/rust/src/timing.rs+++ b/library/map/src/main/rust/src/timing.rs@@ -286,6 +286,10 @@ impl ReportThrottle { }  /// Nanos between two `Instant` reads, saturating rather than wrapping on absurd values.+///+/// Only the Android frame paths call this; host builds compile `timing`+/// solely for its unit tests, which use the injected-sample API.+#[cfg(target_os = "android")] pub(crate) fn nanos_since(start: std::time::Instant) -> u64 {     u64::try_from(start.elapsed().as_nanos()).unwrap_or(u64::MAX) }
library/map/src/main/rust/src/vulkan/renderer/placement.rs
diff --git a/library/map/src/main/rust/src/vulkan/renderer/placement.rs b/library/map/src/main/rust/src/vulkan/renderer/placement.rsindex 09dc8f390f..4c1c16f3d5 100644--- a/library/map/src/main/rust/src/vulkan/renderer/placement.rs+++ b/library/map/src/main/rust/src/vulkan/renderer/placement.rs@@ -174,7 +174,12 @@ impl Renderer {                         let placed = crate::tess::text::layout_along_line(line, centreline, ppfu);                         let boxes = if globe {                             placement::globe_curved_boxes(-                                camera, tile.z, tile.x, tile.y,+                                camera,+                                placement::TileRef {+                                    z: tile.z,+                                    x: tile.x,+                                    y: tile.y,+                                },                                 &placed, tile_clip, wh, inputs.text_px, inputs.pad_px,                             )                         } else {@@ -188,12 +193,17 @@ impl Renderer {                         (boxes, None)                     } else {                         let (primary_rect, alt) = if globe {+                            let tile_ref = placement::TileRef {+                                z: tile.z,+                                x: tile.x,+                                y: tile.y,+                            };                             let Some(primary_rect) = placement::globe_anchored_rect(-                                camera, tile.z, tile.x, tile.y, label.anchor, wh, &inputs, primary,+                                camera, tile_ref, label.anchor, wh, &inputs, primary,                             ) else { continue };                             let alt = alternate.and_then(|second| {                                 placement::globe_anchored_rect(-                                    camera, tile.z, tile.x, tile.y, label.anchor, wh, &inputs, second,+                                    camera, tile_ref, label.anchor, wh, &inputs, second,                                 )                                 .map(|r| vec![placement::Obb::from_rect(r)])                             });
library/map/src/main/rust/src/vulkan/renderer/placement_refresh.rs
diff --git a/library/map/src/main/rust/src/vulkan/renderer/placement_refresh.rs b/library/map/src/main/rust/src/vulkan/renderer/placement_refresh.rsindex f99c444d0d..e3ede5e1fb 100644--- a/library/map/src/main/rust/src/vulkan/renderer/placement_refresh.rs+++ b/library/map/src/main/rust/src/vulkan/renderer/placement_refresh.rs@@ -43,7 +43,13 @@ impl Renderer {         // globe); an unprojectable anchor has no box and no hit.         let rect = if globe {             placement::globe_anchored_rect(-                camera, tile.z, tile.x, tile.y, label.anchor,+                camera,+                placement::TileRef {+                    z: tile.z,+                    x: tile.x,+                    y: tile.y,+                },+                label.anchor,                 extent_wh, &box_inputs(layer, label, camera), anchor,             )         } else {