From 7bb10a77591c14bc426155594b904e2b45ab5159 Mon Sep 17 00:00:00 2001 From: Tanish Manku Date: Wed, 14 Oct 2026 16:11:18 -0700 Subject: [PATCH] style: rustfmt five files on main (fmt break from #5448, #5670, #5135) (#5873) Formatting only; cargo fmt --all -- --check passes again. --- crates/engine/src/channel_cmds.rs | 11 +++-------- crates/engine/src/video_cmds.rs | 9 ++------- crates/ui-egui/src/adjust_dialog.rs | 10 ++-------- crates/ui-egui/src/tone.rs | 19 ++++++++++++------- crates/ui-egui/src/widgets.rs | 10 +++++++++- 5 files changed, 28 insertions(+), 31 deletions(-) diff --git a/crates/engine/src/channel_cmds.rs b/crates/engine/src/channel_cmds.rs index 6dac6f2a69..468db2698b 100644 --- a/crates/engine/src/channel_cmds.rs +++ b/crates/engine/src/channel_cmds.rs @@ -242,14 +242,9 @@ pub fn isolated_curve_channel_for(st: &DocState, layers_panel_mask: bool) -> Opt translate: false, gray: Some(GraySurface::Alpha(i)), }), - ChannelTarget::Composite if doc.quick_mask.is_some() => Some(IsolatedCurveChannel { - name: "Quick Mask".into(), - key: "", - hist: 0, - tint: false, - translate: true, - gray: Some(GraySurface::QuickMask), - }), + ChannelTarget::Composite if doc.quick_mask.is_some() => { + Some(IsolatedCurveChannel { name: "Quick Mask".into(), key: "", hist: 0, tint: false, translate: true, gray: Some(GraySurface::QuickMask) }) + } ChannelTarget::LayerMask => layer_mask_curve_channel(st), ChannelTarget::Composite if crate::mask_view_cmds::current(st).is_some() || layers_panel_mask => layer_mask_curve_channel(st), _ => None, diff --git a/crates/engine/src/video_cmds.rs b/crates/engine/src/video_cmds.rs index dcb184c675..6fb9ab4574 100644 --- a/crates/engine/src/video_cmds.rs +++ b/crates/engine/src/video_cmds.rs @@ -422,10 +422,7 @@ pub fn render_video_with( let frames = base.timeline.as_ref().map_or(1, |t| t.duration).max(1); // Loaded timelines bypass the duration validation used by timeline.create/setProps. if frames > crate::timeline_cmds::MAX_DURATION { - return Err(EngineError::Other(format!( - "the timeline is {frames} frames; Render Video is limited to {} frames", - crate::timeline_cmds::MAX_DURATION - ))); + return Err(EngineError::Other(format!("the timeline is {frames} frames; Render Video is limited to {} frames", crate::timeline_cmds::MAX_DURATION))); } let fps = base.timeline.as_ref().map_or(30.0, |t| t.fps).max(1.0); let stem = base.name.rsplit_once('.').map_or(base.name.as_str(), |(a, _)| a).to_string(); @@ -443,9 +440,7 @@ pub fn render_video_with( // The whole canvas is staged as f32 RGBA for each frame; reject over-budget // dimensions before an infallible allocation can abort the process. if (w as u64) * (h as u64) > MAX_GIF_FRAME_PIXELS { - return Err(EngineError::Other(format!( - "{w} × {h} is too large to render as an animated GIF (limit {MAX_GIF_FRAME_PIXELS} pixels per frame)" - ))); + return Err(EngineError::Other(format!("{w} × {h} is too large to render as an animated GIF (limit {MAX_GIF_FRAME_PIXELS} pixels per frame)"))); } let delay = (100.0 / fps).round().clamp(1.0, 65535.0) as u16; let mut gframes = Vec::with_capacity(frames); diff --git a/crates/ui-egui/src/adjust_dialog.rs b/crates/ui-egui/src/adjust_dialog.rs index cabf9fbded..be9acde2e8 100644 --- a/crates/ui-egui/src/adjust_dialog.rs +++ b/crates/ui-egui/src/adjust_dialog.rs @@ -196,11 +196,7 @@ fn isolated(app: &PhotocraftApp) -> Option photocraft_doc::ColorMode { let mode = app.session.active().map_or(photocraft_doc::ColorMode::Rgb, |s| s.doc.mode); - if kind == "curves" && isolated(app).is_some_and(|c| c.gray.is_some()) { - photocraft_doc::ColorMode::Grayscale - } else { - mode - } + if kind == "curves" && isolated(app).is_some_and(|c| c.gray.is_some()) { photocraft_doc::ColorMode::Grayscale } else { mode } } /// Dialog body: the kind's editor over the fields, then the Preview checkbox. @@ -874,8 +870,6 @@ mod tests { /// The Channel popup's selected value (its option labels are what it shows). fn popup_channels(h: &mut Harness<'static, PhotocraftApp>) -> Vec { - h.query_all_by_role(egui::accesskit::Role::ComboBox) - .filter_map(|n| n.value().map(|s| s.to_string())) - .collect() + h.query_all_by_role(egui::accesskit::Role::ComboBox).filter_map(|n| n.value().map(|s| s.to_string())).collect() } } diff --git a/crates/ui-egui/src/tone.rs b/crates/ui-egui/src/tone.rs index 5cd04d4f0b..ba17755bd9 100644 --- a/crates/ui-egui/src/tone.rs +++ b/crates/ui-egui/src/tone.rs @@ -76,11 +76,14 @@ fn isolate(layers: &mut [Layer], id: LayerId) -> bool { /// Histograms of `doc` as seen by `source`, in the channels of `space`. pub fn compute_histograms(doc: &Document, source: HistSource, space: ToneSpace) -> Histograms { - let mut h = vec![[0u32; 256]; match space { - ToneSpace::Rgb => 4, - ToneSpace::Cmyk => 5, - ToneSpace::Lab => 3, - }]; + let mut h = vec![ + [0u32; 256]; + match space { + ToneSpace::Rgb => 4, + ToneSpace::Cmyk => 5, + ToneSpace::Lab => 3, + } + ]; match source { // The gray plane itself: its levels are what the curve edits, whatever the document's // colour mode (#5335). @@ -443,8 +446,10 @@ mod tests { let m = compute_histograms(&st.doc, HistSource::Channel { layer, surface: GraySurface::LayerMask }, ToneSpace::Rgb); assert!(m[0][0] > 0, "the hidden mask is black"); // Each plane keeps its own cache entry: switching targets recomputes. - assert_ne!(tag(HistSource::Channel { layer, surface: GraySurface::Alpha(0) }, ToneSpace::Rgb), - tag(HistSource::Channel { layer, surface: GraySurface::LayerMask }, ToneSpace::Rgb)); + assert_ne!( + tag(HistSource::Channel { layer, surface: GraySurface::Alpha(0) }, ToneSpace::Rgb), + tag(HistSource::Channel { layer, surface: GraySurface::LayerMask }, ToneSpace::Rgb) + ); assert_ne!(tag(HistSource::Channel { layer, surface: GraySurface::LayerMask }, ToneSpace::Rgb), tag(HistSource::Layer(layer), ToneSpace::Rgb)); } } diff --git a/crates/ui-egui/src/widgets.rs b/crates/ui-egui/src/widgets.rs index c6e62ecaa1..93f9679702 100644 --- a/crates/ui-egui/src/widgets.rs +++ b/crates/ui-egui/src/widgets.rs @@ -1358,7 +1358,15 @@ pub fn dropdown_wheel_hovered(ui: &mut Ui, id: &str, curre } #[allow(clippy::too_many_arguments)] -fn dropdown_with(ui: &mut Ui, id: &str, current: &mut T, options: &[(T, &str)], width: f32, wheel: bool, translate: bool) -> (Vec, Option) { +fn dropdown_with( + ui: &mut Ui, + id: &str, + current: &mut T, + options: &[(T, &str)], + width: f32, + wheel: bool, + translate: bool, +) -> (Vec, Option) { let shown = |l: &str| if translate { tl!(l).to_string() } else { l.to_string() }; let label = options.iter().find(|(v, _)| v == current).map(|(_, l)| shown(l)).unwrap_or_else(|| "—".into()); let (mut chosen, mut hovered) = (Vec::new(), None);