style(simulation): rustfmt + clippy fixes for Layer-1/heightmap code (#953 #963)

Pre-push surfaced fmt + clippy (-D warnings) failures in the new code:
- rustfmt the 6 new/changed atlas files + the bench example.
- features.rs: HashMap → BTreeMap (project bans HashMap for determinism via
  clippy disallowed_types; the bucket map is lookup-only either way).
- attractor_matching.rs: drop now-redundant .clone() on AttractorType (it
  became Copy in #953) — clippy clone_on_copy.
- drainage.rs tests: manual range → (1..=12).contains(&n).
- features.rs test: drop .clone() on Copy AttractorType.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-23 10:11:43 +02:00
co-authored by Claude Opus 4.7
parent 7440e933d6
commit f3e017a12f
7 changed files with 96 additions and 43 deletions
+10 -8
View File
@@ -35,8 +35,7 @@ pub struct Layer1Output {
/// Run the Layer-1 topography pipeline for a single body.
pub fn run_layer1(hm: &BodyHeightmap) -> Layer1Output {
let drainage: DrainageResult =
drainage::analyze(&hm.data, hm.width, hm.height, hm.sea_level);
let drainage: DrainageResult = drainage::analyze(&hm.data, hm.width, hm.height, hm.sea_level);
let ta: TerrainAnalysis = TerrainAnalysis::analyze(hm, &drainage);
let raw = features::extract_attractors(hm, &drainage, &ta);
@@ -162,18 +161,21 @@ mod tests {
b.terrain_modification_cost.to_bits()
);
}
assert_eq!(
o1.river_network.river_cells,
o2.river_network.river_cells
);
assert_eq!(o1.river_network.river_cells, o2.river_network.river_cells);
}
#[test]
fn produces_attractors_and_costs() {
let o = run_layer1(&hm(256, 128));
assert!(!o.attractors.is_empty(), "expected some attractors");
assert!(o.attractors.iter().all(|a| a.terrain_modification_cost >= 1.0));
assert!(o.attractors.iter().all(|a| (0.0..=1.0).contains(&a.strength)));
assert!(o
.attractors
.iter()
.all(|a| a.terrain_modification_cost >= 1.0));
assert!(o
.attractors
.iter()
.all(|a| (0.0..=1.0).contains(&a.strength)));
}
#[test]