From 9ac15de269df550b8293e3bbb64f249fd5d4abea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Thu, 27 Aug 2026 07:29:18 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20style(app):=20cargo=20fmt=20pass?= =?UTF-8?q?=20over=20the=20media-kind=20verb-filtering=20diff?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No behavior change -- just rustfmt normalizing line wraps the prior commit left ragged. --- crates/app/src/interact.rs | 1 - crates/app/src/player/library.rs | 3 ++- crates/app/src/player/timeline_edit.rs | 8 ++++++- crates/app/src/player/transport.rs | 3 +-- crates/app/src/subs.rs | 7 +++++- crates/app/src/tests/cards.rs | 30 ++++++++++++++++++++------ crates/app/src/tests/layout.rs | 8 +++++-- crates/app/src/tests/mod.rs | 20 ++++++++--------- crates/app/src/tests/view.rs | 11 ++++++---- crates/app/src/timeline_math.rs | 1 - crates/app/src/ui/bench_stance.rs | 20 +++++++++++++---- crates/app/src/ui/stance.rs | 10 +++++---- crates/app/src/ui/widgets.rs | 10 +++++++-- crates/app/src/viewport.rs | 1 - 14 files changed, 92 insertions(+), 41 deletions(-) diff --git a/crates/app/src/interact.rs b/crates/app/src/interact.rs index 32fa24a..163ca37 100644 --- a/crates/app/src/interact.rs +++ b/crates/app/src/interact.rs @@ -335,4 +335,3 @@ pub(crate) fn repeats(scope: Repeat, key: &str, action: Option) -> boo Repeat::Nothing => false, } } - diff --git a/crates/app/src/player/library.rs b/crates/app/src/player/library.rs index 68f1a71..e9a428e 100644 --- a/crates/app/src/player/library.rs +++ b/crates/app/src/player/library.rs @@ -626,7 +626,8 @@ impl Player { // still being walked ([`Player::toggle_proxy`]'s `Asked` arm) sets it, // so the walk unwinds mid-read instead of running to completion. let cancel = std::sync::Arc::new(std::sync::atomic::AtomicBool::new(false)); - self.proxies.insert(path.clone(), Proxy::Asked(cancel.clone())); + self.proxies + .insert(path.clone(), Proxy::Asked(cancel.clone())); let started = cx.background_executor().spawn({ let path = path.clone(); async move { engine::proxy::generate_if_wanted(&path, &cancel) } diff --git a/crates/app/src/player/timeline_edit.rs b/crates/app/src/player/timeline_edit.rs index aaae627..5a93948 100644 --- a/crates/app/src/player/timeline_edit.rs +++ b/crates/app/src/player/timeline_edit.rs @@ -1658,7 +1658,13 @@ impl Player { /// [`Project::crossfade`]), so a step past the successor's own length /// lands at the successor's length instead of asking for more than /// there is. - pub(crate) fn nudge_transition(&mut self, lane: Lane, idx: usize, step: i32, cx: &mut Context) { + pub(crate) fn nudge_transition( + &mut self, + lane: Lane, + idx: usize, + step: i32, + cx: &mut Context, + ) { let Some(session) = &mut self.session else { return; }; diff --git a/crates/app/src/player/transport.rs b/crates/app/src/player/transport.rs index 3eb43c9..2be6b48 100644 --- a/crates/app/src/player/transport.rs +++ b/crates/app/src/player/transport.rs @@ -54,8 +54,7 @@ impl Player { // a frame counter this pump keeps -- the same `now()` // [`Player::step`] reads. let loop_window = active_loop_window(self.loop_on, self.range, self.loop_trim); - if session.is_playing() && should_loop_restart(frame_at(session.now(), fps), loop_window) - { + if session.is_playing() && should_loop_restart(frame_at(session.now(), fps), loop_window) { let start = loop_window.map_or(0, |(lo, _)| lo); session.seek(f64::from(start) / fps); } diff --git a/crates/app/src/subs.rs b/crates/app/src/subs.rs index af0d5eb..7e8776e 100644 --- a/crates/app/src/subs.rs +++ b/crates/app/src/subs.rs @@ -259,7 +259,12 @@ pub(crate) fn audio_import_tail(path: &std::path::Path, has_video: bool) -> Stri let secs = engine::AudioSession::duration_secs(path).ok().flatten(); match (probe, secs) { (Some(p), Some(secs)) => { - format!(" — {} Hz, {} ch, {}s", p.sample_rate, p.channels, secs.round() as u64) + format!( + " — {} Hz, {} ch, {}s", + p.sample_rate, + p.channels, + secs.round() as u64 + ) } _ => String::new(), } diff --git a/crates/app/src/tests/cards.rs b/crates/app/src/tests/cards.rs index 63f9103..2b7fef2 100644 --- a/crates/app/src/tests/cards.rs +++ b/crates/app/src/tests/cards.rs @@ -1028,7 +1028,12 @@ fn a_typed_bitrate_is_a_field_and_not_a_key_capture() { let mut edit = mbps_edit(0); edit.digit(0); assert_eq!(edit.commit(), None); - assert!(edit.refusal.clone().expect("zero says why").contains("0 is not a value")); + assert!( + edit.refusal + .clone() + .expect("zero says why") + .contains("0 is not a value") + ); assert_eq!(mbps_edit(MBPS_MIN).commit(), Some(MBPS_MIN)); assert_eq!(mbps_edit(MBPS_MAX).commit(), Some(MBPS_MAX)); let mut edit = mbps_edit(0); @@ -1143,7 +1148,10 @@ fn a_duration_row_shows_only_for_a_transition_and_its_room_is_the_successors() { // A plain cut carries neither field, so the row has nothing to show. let plain = clip(0, 10, 0, 0, 0); let plain_next = clip(10, 15, 0, 0, 0); - assert_eq!(transition_of(LaneKind::Video, &plain, Some(&plain_next)), None); + assert_eq!( + transition_of(LaneKind::Video, &plain, Some(&plain_next)), + None + ); // A dissolve: video lane, `transition_out` set, an adjacent successor. // The room offered is the shorter of the two -- here the successor's own @@ -1506,11 +1514,16 @@ fn the_export_card_fits_the_smallest_window() { (17. + 28. + 15. + 30. + CONTROL_H + 4. + 10. + 24.), title + status + summary + CONTROL_H + 4. + gaps + padding ); - assert!((17. + 28. + 15. + 30. + CONTROL_H + 4. + 10. + 24.) + (8. * KEYS_ROW_H) <= 360., "card too tall"); + assert!( + (17. + 28. + 15. + 30. + CONTROL_H + 4. + 10. + 24.) + (8. * KEYS_ROW_H) <= 360., + "card too tall" + ); // The list grows with a window that has the room -- and never shrinks // below the cap that made the floor fit, whatever arithmetic the window // hands it. - let cap = |h: f32| (h - (17. + 28. + 15. + 30. + CONTROL_H + 4. + 10. + 24.) - 24.).max(8. * KEYS_ROW_H); + let cap = |h: f32| { + (h - (17. + 28. + 15. + 30. + CONTROL_H + 4. + 10. + 24.) - 24.).max(8. * KEYS_ROW_H) + }; assert_eq!(cap(360.), (8. * KEYS_ROW_H)); assert_eq!(cap(0.), (8. * KEYS_ROW_H)); assert!(cap(720.) > (8. * KEYS_ROW_H)); @@ -2096,14 +2109,17 @@ fn darkroom_source_rows_keep_proxy_add_and_media_audio_text_paths() { #[test] fn toggle_proxy_wakes_the_asked_phase_it_stops() { let library = src_text("player/library.rs"); - let start = &library[library.find("fn start_proxy_for(").expect("start_proxy_for")..]; + let start = &library[library + .find("fn start_proxy_for(") + .expect("start_proxy_for")..]; assert!( start.contains("generate_if_wanted(&path, &cancel)"), "start_proxy_for no longer hands the header read a cancel flag anyone can reach" ); let toggle = &library[library.find("fn toggle_proxy(").expect("toggle_proxy")..]; - let asked_arm = - &toggle[toggle.find("Proxy::Asked(cancel)").expect("the Asked arm's own flag")..]; + let asked_arm = &toggle[toggle + .find("Proxy::Asked(cancel)") + .expect("the Asked arm's own flag")..]; assert!( asked_arm.contains("cancel.store(true"), "a stop asked during Asked no longer sets the flag the header read polls" diff --git a/crates/app/src/tests/layout.rs b/crates/app/src/tests/layout.rs index 18b2c3a..5c6f52a 100644 --- a/crates/app/src/tests/layout.rs +++ b/crates/app/src/tests/layout.rs @@ -272,11 +272,15 @@ fn a_stateful_button_keeps_its_rect() { // `armed` (whether cancel is armed), and neither may gate its own // button out of the tree. let cards = src_text("ui/cards.rs"); - for (id, flag) in [("\"eq-spectrum\"", "self.eq_spectrum"), ("\"export-cancel\"", "armed")] { + for (id, flag) in [ + ("\"eq-spectrum\"", "self.eq_spectrum"), + ("\"export-cancel\"", "armed"), + ] { let at = cards.find(id).unwrap_or_else(|| panic!("no {id} button")); let before = &cards[at.saturating_sub(350)..at]; assert!( - !before.contains(&format!(".when({flag}")) && !before.contains(&format!(".when(!{flag}")), + !before.contains(&format!(".when({flag}")) + && !before.contains(&format!(".when(!{flag}")), "{id} is gated on the very flag it flips -- its rect would move when the state does" ); } diff --git a/crates/app/src/tests/mod.rs b/crates/app/src/tests/mod.rs index eb30353..822d724 100644 --- a/crates/app/src/tests/mod.rs +++ b/crates/app/src/tests/mod.rs @@ -22,16 +22,16 @@ use super::{ SPEED_PRESETS, SPEED_STEP, STATUS_ERROR, STATUS_SUCCESS, STATUS_WARNING, SUB_PLAN_CHARS, Source, Speed, StreamInfo, TIMELINE_SHARE, Transport, VOLUME_W, Volume, WAVE_BPS, WAVE_COL, WAVE_COLS_MAX, Wave, ZOOM_MIN_FRAMES, active_lane, band_label, bitrate_detail, bitrate_refusal, - clipboard_after_remove, color_snap, containers, enable, enable_lane, envelope, - eq_card_w, eq_freq, eq_freq_label, eq_graph_h, eq_spectrum, eq_x, eq_y, estimated_bytes, - export_path, export_settings, format_line, format_refusal, fps_choices, fps_label, frac_along, - frac_down, frame_at, frame_rate_ladder, histogram, inserted_band, is_project, keymap, - keys_rows, lanes_h, marked, menu_at, menu_items, menu_rows_h, next_container, normalise, - nothing_to_play, notice_tone, panel_h, project_path, proxies_to_start, push_notice, px_below, - retarget, row_enable, row_items, scrub_due, secs_label, should_resync, silence_rate, - size_label, snap_cue, snap_marks, snapped, source_tint, span_partner, speed_at, - sub_pick_after_removal, subtitle_plan, summary_head, summary_tail, timecode, timeline_fixed_h, - tip_may_paint, transport, typed, unseen_paths, unseen_sources, whole_take, window_title, + clipboard_after_remove, color_snap, containers, enable, enable_lane, envelope, eq_card_w, + eq_freq, eq_freq_label, eq_graph_h, eq_spectrum, eq_x, eq_y, estimated_bytes, export_path, + export_settings, format_line, format_refusal, fps_choices, fps_label, frac_along, frac_down, + frame_at, frame_rate_ladder, histogram, inserted_band, is_project, keymap, keys_rows, lanes_h, + marked, menu_at, menu_items, menu_rows_h, next_container, normalise, nothing_to_play, + notice_tone, panel_h, project_path, proxies_to_start, push_notice, px_below, retarget, + row_enable, row_items, scrub_due, secs_label, should_resync, silence_rate, size_label, + snap_cue, snap_marks, snapped, source_tint, span_partner, speed_at, sub_pick_after_removal, + subtitle_plan, summary_head, summary_tail, timecode, timeline_fixed_h, tip_may_paint, + transport, typed, unseen_paths, unseen_sources, whole_take, window_title, }; use super::{ diff --git a/crates/app/src/tests/view.rs b/crates/app/src/tests/view.rs index f2f8be7..de6fe56 100644 --- a/crates/app/src/tests/view.rs +++ b/crates/app/src/tests/view.rs @@ -136,8 +136,7 @@ fn a_lane_refuses_the_files_it_cannot_hold_before_the_release_says_so() { // ...and a subtitle lane holds none of the three: a caption comes off the // Subtitles list, which is where the refusal points. for (file, has_video) in [(sound, false), (still, true), (movie, true)] { - let why = - lane_refuses(file, Lane::S1, has_video).expect("a subtitle lane takes no media"); + let why = lane_refuses(file, Lane::S1, has_video).expect("a subtitle lane takes no media"); assert!(why.starts_with("NOT ON S1 — "), "{why}"); assert!(why.contains("Subtitles list"), "{why}"); } @@ -937,7 +936,9 @@ fn only_tab_is_intercepted_by_a_focused_surface_everything_else_reaches_root() { use crate::ui::stance::is_focus_cycle_key; assert!(is_focus_cycle_key("tab")); - for key in ["space", "escape", "s", "c", "left", "right", "enter", "delete", "?"] { + for key in [ + "space", "escape", "s", "c", "left", "right", "enter", "delete", "?", + ] { assert!(!is_focus_cycle_key(key), "{key} must bubble to the root"); } } @@ -952,7 +953,9 @@ fn escape_is_the_only_key_a_focused_surface_uses_to_leave_the_ring() { use crate::ui::stance::is_focus_exit_key; assert!(is_focus_exit_key("escape")); - for key in ["tab", "space", "s", "c", "left", "right", "enter", "delete", "?"] { + for key in [ + "tab", "space", "s", "c", "left", "right", "enter", "delete", "?", + ] { assert!(!is_focus_exit_key(key), "{key} must not exit the ring"); } } diff --git a/crates/app/src/timeline_math.rs b/crates/app/src/timeline_math.rs index 7091c2b..22a52eb 100644 --- a/crates/app/src/timeline_math.rs +++ b/crates/app/src/timeline_math.rs @@ -427,7 +427,6 @@ pub(crate) fn sub_mark(subs: &[SubClip], start: u32) -> Option { subs.iter().position(|s| s.start == start) } - /// Scales an envelope to its own loudest sample, so a quietly mastered source /// still draws as a shape. The fixtures peak around an eighth of full scale, and /// an eighth of a 30 px lane is a flat line -- which says "silent" about a file diff --git a/crates/app/src/ui/bench_stance.rs b/crates/app/src/ui/bench_stance.rs index aae494e..f7b31c2 100644 --- a/crates/app/src/ui/bench_stance.rs +++ b/crates/app/src/ui/bench_stance.rs @@ -1048,7 +1048,10 @@ fn lane_row( ) .drag_over::(|d, _, _, _| d.bg(rgb(DARK_RAISED()))) .on_drop(cx.listener(move |this, drag: &AssetDrag, window, cx| { - let x = this.drag_x.take().unwrap_or_else(|| window.mouse_position().x); + let x = this + .drag_x + .take() + .unwrap_or_else(|| window.mouse_position().x); let at = this.place_frame(x).0; this.insert_source(&drag.0.clone(), drag.1, Some(lane), Some(at), cx) })) @@ -1090,7 +1093,10 @@ fn lane_row( let Some(idx) = this.dragged(drag) else { return; }; - let x = this.drag_x.take().unwrap_or_else(|| window.mouse_position().x); + let x = this + .drag_x + .take() + .unwrap_or_else(|| window.mouse_position().x); this.move_clip(drag.lane, idx, lane, x, cx) })) .on_drag_move( @@ -1108,7 +1114,10 @@ fn lane_row( // the same call `ui/timeline.rs`'s own bed makes). .drag_over::(|d, _, _, _| d.bg(rgb(DARK_RAISED()))) .on_drop(cx.listener(move |this, drag: &SubDrag, window, cx| { - let x = this.drag_x.take().unwrap_or_else(|| window.mouse_position().x); + let x = this + .drag_x + .take() + .unwrap_or_else(|| window.mouse_position().x); this.move_sub(drag, lane, x, cx); })) .on_drag_move( @@ -1123,7 +1132,10 @@ fn lane_row( ) .drag_over::(|d, _, _, _| d.bg(rgb(DARK_RAISED()))) .on_drop(cx.listener(move |this, drag: &SubPick, window, cx| { - let x = this.drag_x.take().unwrap_or_else(|| window.mouse_position().x); + let x = this + .drag_x + .take() + .unwrap_or_else(|| window.mouse_position().x); this.place_sub(drag.0, lane, x, cx); })) .on_drag_move( diff --git a/crates/app/src/ui/stance.rs b/crates/app/src/ui/stance.rs index 2241eef..85306cd 100644 --- a/crates/app/src/ui/stance.rs +++ b/crates/app/src/ui/stance.rs @@ -42,7 +42,11 @@ const SURFACE_CYCLE: [Surface; 3] = [Surface::Dock, Surface::Bench, Surface::Ins pub(crate) fn next_surface(current: Surface, backward: bool) -> Surface { let i = SURFACE_CYCLE.iter().position(|&s| s == current).unwrap(); let n = SURFACE_CYCLE.len(); - SURFACE_CYCLE[if backward { (i + n - 1) % n } else { (i + 1) % n }] + SURFACE_CYCLE[if backward { + (i + n - 1) % n + } else { + (i + 1) % n + }] } /// The one key a surface's own `on_key_down` answers. Everything else is @@ -396,9 +400,7 @@ fn ghost( .rounded(px(3.)) .cursor_pointer() .hover(|s| s.bg(rgb(DARK_RAISED())).text_color(rgb(INK1()))) - .on_click(cx.listener(move |this, _: &ClickEvent, window, cx| { - this.act(action, window, cx) - })) + .on_click(cx.listener(move |this, _: &ClickEvent, window, cx| this.act(action, window, cx))) .type_style(type_scale::label( type_scale::LABEL_ROW_PX, gpui::FontWeight::MEDIUM, diff --git a/crates/app/src/ui/widgets.rs b/crates/app/src/ui/widgets.rs index 4b336a5..b0aaadb 100644 --- a/crates/app/src/ui/widgets.rs +++ b/crates/app/src/ui/widgets.rs @@ -315,7 +315,10 @@ impl NumberEdit { /// past. pub(crate) fn digit(&mut self, digit: u32) { if self.text.chars().count() >= self.digits { - self.refusal = Some(format!("{} digits is already past the ceiling", self.digits)); + self.refusal = Some(format!( + "{} digits is already past the ceiling", + self.digits + )); return; } match char::from_digit(digit, 10) { @@ -370,7 +373,10 @@ impl NumberEdit { None } Ok(v) => { - self.refusal = Some(format!("{v} is past the {} {} ceiling", self.max, self.unit)); + self.refusal = Some(format!( + "{v} is past the {} {} ceiling", + self.max, self.unit + )); None } Err(_) => { diff --git a/crates/app/src/viewport.rs b/crates/app/src/viewport.rs index 6531f49..8e4399a 100644 --- a/crates/app/src/viewport.rs +++ b/crates/app/src/viewport.rs @@ -2,7 +2,6 @@ use crate::*; - /// A span of seconds as a person reads it: one decimal above a second, two /// below -- [`scaled`]'s rule, for its reason. The tightest zoom is /// [`ZOOM_MIN_FRAMES`] across the bed, which on the 240 fps slow-motion a phone