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:
2026-08-22 21:16:34 +02:00
co-authored by Claude Opus 5
parent d04087af83
commit c75849040c
45 changed files with 545 additions and 257 deletions
+35 -19
View File
@@ -206,7 +206,13 @@ impl SegmentationJob {
// few places in this codebase where not linearising is correct.
let rgb = rgba
.chunks_exact(4)
.flat_map(|p| [p[0] as f32 / 255.0, p[1] as f32 / 255.0, p[2] as f32 / 255.0])
.flat_map(|p| {
[
p[0] as f32 / 255.0,
p[1] as f32 / 255.0,
p[2] as f32 / 255.0,
]
})
.collect();
Ok((rgb, pw as usize, ph as usize))
}
@@ -1458,10 +1464,7 @@ impl DevelopSession {
/// What kind of mask a layer is — "regions", "linear", "radial".
pub fn mask_kind(&self, id: &str) -> &'static str {
self.graph
.masks()
.get(id)
.map_or("", |l| l.source.kind())
self.graph.masks().get(id).map_or("", |l| l.source.kind())
}
pub fn mask_inverted(&self, id: &str) -> bool {
@@ -1625,7 +1628,11 @@ impl DevelopSession {
width: 0.3,
}
};
if !self.graph.masks_mut().push(MaskLayer::new(id.clone(), source)) {
if !self
.graph
.masks_mut()
.push(MaskLayer::new(id.clone(), source))
{
return None;
}
self.active_mask = Some(id.clone());
@@ -1660,7 +1667,8 @@ impl DevelopSession {
pub fn set_mask_feather(&mut self, id: &str, feather: f32) {
if let Some(layer) = self.graph.masks_mut().get_mut(id) {
layer.feather = feather.clamp(0.0, 1.0);
self.history.record(&self.graph, Edit::Op(OpId("mask-feather")));
self.history
.record(&self.graph, Edit::Op(OpId("mask-feather")));
}
}
@@ -1694,7 +1702,8 @@ impl DevelopSession {
pub fn set_mask_morph_radius(&mut self, id: &str, radius: f32) {
if let Some(layer) = self.graph.masks_mut().get_mut(id) {
layer.morph_radius = radius.clamp(0.0, 1.0);
self.history.record(&self.graph, Edit::Op(OpId("mask-morph")));
self.history
.record(&self.graph, Edit::Op(OpId("mask-morph")));
}
}
@@ -1702,7 +1711,10 @@ impl DevelopSession {
pub fn mask_falloff(&self, id: &str) -> usize {
use dr_pipeline::mask::Falloff;
self.graph.masks().get(id).map_or(0, |l| {
Falloff::ALL.iter().position(|&f| f == l.falloff).unwrap_or(0)
Falloff::ALL
.iter()
.position(|&f| f == l.falloff)
.unwrap_or(0)
})
}
@@ -1732,7 +1744,10 @@ impl DevelopSession {
pub fn mask_is_shapeable(&self, id: &str) -> bool {
use dr_pipeline::mask::MaskSource;
self.graph.masks().get(id).is_some_and(|l| {
matches!(l.source, MaskSource::Subject { .. } | MaskSource::Regions { .. })
matches!(
l.source,
MaskSource::Subject { .. } | MaskSource::Regions { .. }
)
})
}
@@ -1742,7 +1757,8 @@ impl DevelopSession {
// `Op` rather than `Discrete`: opacity is dragged, and a drag is
// one decision however many values it passes through. `Discrete`
// would put every intermediate position on the undo stack.
self.history.record(&self.graph, Edit::Op(OpId("mask-opacity")));
self.history
.record(&self.graph, Edit::Op(OpId("mask-opacity")));
}
}
@@ -2510,9 +2526,8 @@ mod tests {
fn a_job_carries_the_session_it_was_taken_from() {
let Some(ctx) = headless() else { return };
let rgba: Vec<u8> = (0..16 * 16).flat_map(|_| [128, 128, 128, 255]).collect();
let session =
DevelopSession::open_rgb(&ctx, &rgba, 16, 16, dr_types::Orientation::NORMAL)
.expect("session");
let session = DevelopSession::open_rgb(&ctx, &rgba, 16, 16, dr_types::Orientation::NORMAL)
.expect("session");
assert_eq!(session.segmentation_job().session(), session.id());
}
@@ -2523,9 +2538,8 @@ mod tests {
fn an_abandoned_job_does_no_work() {
let Some(ctx) = headless() else { return };
let rgba: Vec<u8> = (0..16 * 16).flat_map(|_| [128, 128, 128, 255]).collect();
let session =
DevelopSession::open_rgb(&ctx, &rgba, 16, 16, dr_types::Orientation::NORMAL)
.expect("session");
let session = DevelopSession::open_rgb(&ctx, &rgba, 16, 16, dr_types::Orientation::NORMAL)
.expect("session");
let job = session.segmentation_job();
job.abandon().now();
@@ -3993,7 +4007,10 @@ mod tests {
let narrowed = session.rows().len();
assert!(narrowed > 0, "a tab must show something");
assert!(narrowed < all, "and less than everything: {narrowed} of {all}");
assert!(
narrowed < all,
"and less than everything: {narrowed} of {all}"
);
}
/// The trap: `op_index` counts over *every* capability, so a row that
@@ -4054,7 +4071,6 @@ mod tests {
session.set_active_tab(99);
assert_eq!(session.rows().len(), all);
}
}
/// `dr_pipeline`'s morphology, as `dr_segment` names it.