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:
@@ -457,7 +457,10 @@ fn merge_small_basins(
|
||||
|
||||
while active.len() > min_count {
|
||||
// Smallest active basin (tie → lowest id; BTreeSet iterates ascending).
|
||||
let smallest = *active.iter().min_by_key(|&&b| (size[b as usize], b)).unwrap();
|
||||
let smallest = *active
|
||||
.iter()
|
||||
.min_by_key(|&&b| (size[b as usize], b))
|
||||
.unwrap();
|
||||
let smallest_size = size[smallest as usize];
|
||||
if active.len() <= max_count && smallest_size as f64 / n as f64 >= min_frac {
|
||||
break;
|
||||
@@ -661,7 +664,7 @@ mod tests {
|
||||
let result = analyze(&elev, 128, 64, 0.3);
|
||||
let n = result.drainage_basins.len();
|
||||
assert!(
|
||||
n >= 1 && n <= 12,
|
||||
(1..=12).contains(&n),
|
||||
"Basin count {} out of expected range [1, 12]",
|
||||
n
|
||||
);
|
||||
@@ -693,7 +696,10 @@ mod tests {
|
||||
let r2 = analyze(&elev, 64, 32, 0.3);
|
||||
assert_eq!(r1.flow_accumulation, r2.flow_accumulation);
|
||||
assert_eq!(r1.max_accumulation, r2.max_accumulation);
|
||||
assert!(r1.max_accumulation >= 1, "max_accumulation must be clamped ≥ 1");
|
||||
assert!(
|
||||
r1.max_accumulation >= 1,
|
||||
"max_accumulation must be clamped ≥ 1"
|
||||
);
|
||||
// Flat / all-ocean world: still well-defined (no division by zero).
|
||||
let flat = flat_grid(16, 8, 0.5);
|
||||
let rf = analyze(&flat, 16, 8, 0.9); // sea_level above all terrain
|
||||
@@ -714,6 +720,6 @@ mod tests {
|
||||
}
|
||||
let res = analyze(&elev, w as u32, h as u32, 0.3);
|
||||
let n = res.drainage_basins.len();
|
||||
assert!(n >= 1 && n <= 12, "basin count {n} out of range");
|
||||
assert!((1..=12).contains(&n), "basin count {n} out of range");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user