Format the tree the way the gate asks for it
`cargo fmt --check` is a required step and had drifted across 45 files. Most of it arrived this week: several operations were written in parallel worktrees and merged by hand, and a hand-merge resolves conflicts without ever running the formatter over the result. No behaviour changes — this is `cargo fmt --all` and nothing else, kept as its own commit so the next reader can skip it wholesale rather than search it for one that matters. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -346,8 +346,8 @@ impl Shaped {
|
||||
radius_px: f32,
|
||||
) -> Self {
|
||||
let distance = signed_distance(coverage, width, height, threshold);
|
||||
let distance = apply_morphology(&distance, width, height, morphology, radius_px)
|
||||
.unwrap_or(distance);
|
||||
let distance =
|
||||
apply_morphology(&distance, width, height, morphology, radius_px).unwrap_or(distance);
|
||||
Self {
|
||||
distance,
|
||||
width,
|
||||
@@ -403,7 +403,11 @@ mod tests {
|
||||
// Distance from the boundary, so the half-pixel comes back off to
|
||||
// compare against the centre-to-centre figures.
|
||||
let at = |x: usize, y: usize| -d[y * 5 + x] + 0.5;
|
||||
assert!((at(1, 1) - std::f32::consts::SQRT_2).abs() < 1e-4, "{}", at(1, 1));
|
||||
assert!(
|
||||
(at(1, 1) - std::f32::consts::SQRT_2).abs() < 1e-4,
|
||||
"{}",
|
||||
at(1, 1)
|
||||
);
|
||||
assert!((at(0, 0) - (8.0f32).sqrt()).abs() < 1e-4, "{}", at(0, 0));
|
||||
assert_eq!(at(2, 0), 2.0, "straight up is exactly two");
|
||||
}
|
||||
@@ -489,7 +493,10 @@ mod tests {
|
||||
m[10 * w + 10] = 0;
|
||||
|
||||
let before = signed_distance(&m, w, h, 128);
|
||||
assert!(before[10 * w + 10] < 0.0, "the hole starts outside the mask");
|
||||
assert!(
|
||||
before[10 * w + 10] < 0.0,
|
||||
"the hole starts outside the mask"
|
||||
);
|
||||
|
||||
let after = apply_morphology(&before, w, h, Morphology::Close, 2.0).expect("recomputed");
|
||||
assert!(after[10 * w + 10] >= 0.0, "closing should have filled it");
|
||||
|
||||
Reference in New Issue
Block a user