From 0039bda18403a8d70ae9dd06cecbd06fadd137f4 Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Sun, 26 Jul 2026 13:19:02 +0200 Subject: [PATCH] style(simulation): cargo fmt Co-Authored-By: Claude Fable 5 --- server/src/atlas/road_graph.rs | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/server/src/atlas/road_graph.rs b/server/src/atlas/road_graph.rs index 7c078d697..359940ac0 100644 --- a/server/src/atlas/road_graph.rs +++ b/server/src/atlas/road_graph.rs @@ -1156,7 +1156,8 @@ impl RouteGrid { let (gr0, gc0) = self.to_route_cell(goal); let (sr, sc, s_ring) = self.nearest_passable_cell(sr0, sc0)?; let (gr, gc, g_ring) = self.nearest_passable_cell(gr0, gc0)?; - let surcharge = (s_ring as u32 + g_ring as u32).saturating_mul(COASTAL_ACCESS_COST_PER_RING); + let surcharge = + (s_ring as u32 + g_ring as u32).saturating_mul(COASTAL_ACCESS_COST_PER_RING); let s = sr * self.rw + sc; let g = gr * self.rw + gc; if s == g { @@ -2144,18 +2145,19 @@ mod tests { let dr = drainage::analyze(&hm.data, hm.width, hm.height, hm.sea_level); let ta = TerrainAnalysis::analyze(&hm, &dr); let grid = RouteGrid::build(&ta, &[], w, h); - assert_eq!(grid.scale, 3, "grid_w=180 must downsample at scale=3 for ROUTE_W=64"); + assert_eq!( + grid.scale, 3, + "grid_w=180 must downsample at scale=3 for ROUTE_W=64" + ); let majority_water_cell = 3; // row-major (row 0, col 3) assert_eq!( - grid.cost[majority_water_cell], - IMPASSABLE, + grid.cost[majority_water_cell], IMPASSABLE, "2-of-3 native cells water (a true majority) must be IMPASSABLE" ); let minority_water_cell = 6; // row-major (row 0, col 6) assert_ne!( - grid.cost[minority_water_cell], - IMPASSABLE, + grid.cost[minority_water_cell], IMPASSABLE, "1-of-3 native cells water (a minority) must stay LAND — the \ strict `>` rule does not treat any water touch as impassable" ); @@ -2259,11 +2261,17 @@ mod tests { let dr = drainage::analyze(&hm.data, hm.width, hm.height, hm.sea_level); let ta = TerrainAnalysis::analyze(&hm, &dr); let grid = RouteGrid::build(&ta, &[], w, h); - assert_eq!(grid.cost[3], IMPASSABLE, "sanity: cell (0,3) must be water-majority"); + assert_eq!( + grid.cost[3], IMPASSABLE, + "sanity: cell (0,3) must be water-majority" + ); let (surrogate_r, surrogate_c, ring) = grid .nearest_passable_cell(0, 3) .expect("a passable neighbour must exist"); - assert!(ring >= 1, "the impassable cell must need a real search, ring 0 would be a no-op test"); + assert!( + ring >= 1, + "the impassable cell must need a real search, ring 0 would be a no-op test" + ); // Route A: settlement anchored INSIDE the impassable cell (native col // 11) — must go through the surrogate-anchor relaxation.