style(simulation): gate bounce — box GenCompletion::BodyAnalyzed state; clippy/fmt sweeps

BodyWorldState grew past clippy's large-enum-variant threshold when it
began retaining Layer1Output (T-1170 Ruling 4b) — boxed, with the two
insert sites deref'd; manual_contains x2 (drainage tests),
cloned_ref_to_slice_refs x3 (river_course tests), fmt wraps.
gen_queue 18/18; clippy -D warnings clean; fmt --check clean.

Tickets: T-1170

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-23 14:14:23 +02:00
co-authored by Claude Fable 5
parent 27fab8566a
commit 958de5420e
6 changed files with 232 additions and 59 deletions
+54 -17
View File
@@ -397,10 +397,7 @@ fn stage_a_control_path(
let mut prev_offset = 0.0f64;
for i in 1..STAGE_A_STATIONS - 1 {
let t = i as f64 / (STAGE_A_STATIONS - 1) as f64;
let base = (
anchor_a.0 + dx * t,
anchor_a.1 + dy * t,
);
let base = (anchor_a.0 + dx * t, anchor_a.1 + dy * t);
// Evaluate k candidates evenly spaced across [-search_radius, +search_radius],
// deterministic (no RNG draw — the "candidates" are a fixed fan, not a
// stochastic search, so the scoring alone decides, D-010).
@@ -535,7 +532,12 @@ fn warp_fbm(sx: u64, sy: u64, arc_m: f64, chord_m: f64, min_wavelength_m: f64) -
// stations key on GLOBAL arc-length, never window-relative or 2D
// world position, so overlapping windows agree exactly on the shared
// stretch regardless of where the window happens to be centred).
let n = value_noise(sx.wrapping_add((i as u64).wrapping_mul(0x1000)), arc_m, 0.0, wl);
let n = value_noise(
sx.wrapping_add((i as u64).wrapping_mul(0x1000)),
arc_m,
0.0,
wl,
);
sum += n * amp;
norm += amp;
amp *= 0.5;
@@ -569,9 +571,15 @@ fn sample_polyline_at_arc_length(points: &[CoursePoint], arc_m: f64) -> (CourseP
} else {
remaining / seg_len
};
let pos = (w[0].0 + (w[1].0 - w[0].0) * t, w[0].1 + (w[1].1 - w[0].1) * t);
let pos = (
w[0].0 + (w[1].0 - w[0].0) * t,
w[0].1 + (w[1].1 - w[0].1) * t,
);
let tangent_len = seg_len.max(1e-9);
let tangent = ((w[1].0 - w[0].0) / tangent_len, (w[1].1 - w[0].1) / tangent_len);
let tangent = (
(w[1].0 - w[0].0) / tangent_len,
(w[1].1 - w[0].1) / tangent_len,
);
return (pos, tangent);
}
remaining -= seg_len;
@@ -843,7 +851,10 @@ mod tests {
let a = invent_course(seed, edge, &ta, &params, 2_048.0, 0.0);
let b = invent_course(seed, edge, &ta, &params, 2_048.0, 0.0);
assert_eq!(a.points, b.points, "course invention must be deterministic (D-010/D-227)");
assert_eq!(
a.points, b.points,
"course invention must be deterministic (D-010/D-227)"
);
}
#[test]
@@ -881,7 +892,10 @@ mod tests {
let seed = SeedChain::root(7).derive(SeedDomain::Body, 1);
let station_spacing_m = 2_048.0;
for edge in edges.iter().filter(|e| e.terminus == EdgeTerminusKind::Interior) {
for edge in edges
.iter()
.filter(|e| e.terminus == EdgeTerminusKind::Interior)
{
let course = invent_course(seed, edge, &ta, &params, station_spacing_m, 0.0);
let anchor_a = cell_world_m(edge.upstream, &ta, &params);
let anchor_b = cell_world_m(edge.downstream, &ta, &params);
@@ -933,7 +947,9 @@ mod tests {
// fields' underlying warp_fbm-style noise streams (same seed, same
// world positions) and confirm the Pearson correlation across many
// samples is near zero, not just "not identical."
use crate::atlas::coast_invention::{body_coast_envelope, coast_character_at, coast_warp_px};
use crate::atlas::coast_invention::{
body_coast_envelope, coast_character_at, coast_warp_px,
};
use crate::atlas::district_profile::{GlaciationGrade, TectonicClass};
let params = test_params();
@@ -1013,7 +1029,10 @@ mod tests {
let seed = SeedChain::root(3).derive(SeedDomain::Body, 1);
let a = invent_course(seed, interior[0], &ta, &params, 2_048.0, 0.0);
let b = invent_course(seed, interior[1], &ta, &params, 2_048.0, 0.0);
assert_ne!(a.points, b.points, "distinct edges must invent distinct courses");
assert_ne!(
a.points, b.points,
"distinct edges must invent distinct courses"
);
}
#[test]
@@ -1071,11 +1090,20 @@ mod tests {
bbox,
};
// On the course itself.
assert!(near_perennial_water((50.0, 0.0), &[course.clone()]));
assert!(near_perennial_water(
(50.0, 0.0),
std::slice::from_ref(&course)
));
// Within the 3 m trunk band.
assert!(near_perennial_water((50.0, 2.9), &[course.clone()]));
assert!(near_perennial_water(
(50.0, 2.9),
std::slice::from_ref(&course)
));
// Just outside the band.
assert!(!near_perennial_water((50.0, 3.1), &[course.clone()]));
assert!(!near_perennial_water(
(50.0, 3.1),
std::slice::from_ref(&course)
));
// Far away entirely.
assert!(!near_perennial_water((50.0, 500.0), &[course]));
}
@@ -1095,8 +1123,14 @@ mod tests {
};
// 2.0 m: within tributary band (2.0), outside stream band (1.0).
let probe = (50.0, 1.5);
assert!(near_perennial_water(probe, &[base(1)]), "tributary band should cover 1.5 m");
assert!(!near_perennial_water(probe, &[base(0)]), "stream band should NOT cover 1.5 m");
assert!(
near_perennial_water(probe, &[base(1)]),
"tributary band should cover 1.5 m"
);
assert!(
!near_perennial_water(probe, &[base(0)]),
"stream band should NOT cover 1.5 m"
);
}
#[test]
@@ -1115,7 +1149,10 @@ mod tests {
bbox,
};
let district_spacing_m = 2_048.0;
assert!(!near_perennial_water((5_000.0, district_spacing_m), &[course]));
assert!(!near_perennial_water(
(5_000.0, district_spacing_m),
&[course]
));
}
#[test]