Cargo fmt pass over the media-kind verb-filtering diff
Browse files at this commit9ac15de269df550b8293e3bbb64f249fd5d4abeaParent: 726f956- style
- cargo fmt pass over the media-kind verb-filtering diff
14 changed files +92 -41
- crates/app/src/interact.rs +0 -1
- crates/app/src/player/library.rs +2 -1
- crates/app/src/player/timeline_edit.rs +7 -1
- crates/app/src/player/transport.rs +1 -2
- crates/app/src/subs.rs +6 -1
- crates/app/src/tests/cards.rs +23 -7
- crates/app/src/tests/layout.rs +6 -2
- crates/app/src/tests/mod.rs +10 -10
- crates/app/src/tests/view.rs +7 -4
- crates/app/src/timeline_math.rs +0 -1
- crates/app/src/ui/bench_stance.rs +16 -4
- crates/app/src/ui/stance.rs +6 -4
- crates/app/src/ui/widgets.rs +8 -2
- crates/app/src/viewport.rs +0 -1
crates/app/src/interact.rsmodified+0 -1
| @@ -335,4 +335,3 @@ pub(crate) fn repeats(scope: Repeat, key: &str, action: Option<ActionId>) -> boo | |||
| 335 | Repeat::Nothing => false, | 335 | Repeat::Nothing => false, |
| 336 | } | 336 | } |
| 337 | } | 337 | } |
| 338 | - | ||
crates/app/src/player/library.rsmodified+2 -1
| @@ -626,7 +626,8 @@ impl Player { | |||
| 626 | // still being walked ([`Player::toggle_proxy`]'s `Asked` arm) sets it, | 626 | // still being walked ([`Player::toggle_proxy`]'s `Asked` arm) sets it, |
| 627 | // so the walk unwinds mid-read instead of running to completion. | 627 | // so the walk unwinds mid-read instead of running to completion. |
| 628 | let cancel = std::sync::Arc::new(std::sync::atomic::AtomicBool::new(false)); | 628 | let cancel = std::sync::Arc::new(std::sync::atomic::AtomicBool::new(false)); |
| 629 | - self.proxies.insert(path.clone(), Proxy::Asked(cancel.clone())); | 629 | + self.proxies |
| 630 | + .insert(path.clone(), Proxy::Asked(cancel.clone())); | ||
| 630 | let started = cx.background_executor().spawn({ | 631 | let started = cx.background_executor().spawn({ |
| 631 | let path = path.clone(); | 632 | let path = path.clone(); |
| 632 | async move { engine::proxy::generate_if_wanted(&path, &cancel) } | 633 | async move { engine::proxy::generate_if_wanted(&path, &cancel) } |
crates/app/src/player/timeline_edit.rsmodified+7 -1
| @@ -1658,7 +1658,13 @@ impl Player { | |||
| 1658 | /// [`Project::crossfade`]), so a step past the successor's own length | 1658 | /// [`Project::crossfade`]), so a step past the successor's own length |
| 1659 | /// lands at the successor's length instead of asking for more than | 1659 | /// lands at the successor's length instead of asking for more than |
| 1660 | /// there is. | 1660 | /// there is. |
| 1661 | - pub(crate) fn nudge_transition(&mut self, lane: Lane, idx: usize, step: i32, cx: &mut Context<Self>) { | 1661 | + pub(crate) fn nudge_transition( |
| 1662 | + &mut self, | ||
| 1663 | + lane: Lane, | ||
| 1664 | + idx: usize, | ||
| 1665 | + step: i32, | ||
| 1666 | + cx: &mut Context<Self>, | ||
| 1667 | + ) { | ||
| 1662 | let Some(session) = &mut self.session else { | 1668 | let Some(session) = &mut self.session else { |
| 1663 | return; | 1669 | return; |
| 1664 | }; | 1670 | }; |
crates/app/src/player/transport.rsmodified+1 -2
| @@ -54,8 +54,7 @@ impl Player { | |||
| 54 | // a frame counter this pump keeps -- the same `now()` | 54 | // a frame counter this pump keeps -- the same `now()` |
| 55 | // [`Player::step`] reads. | 55 | // [`Player::step`] reads. |
| 56 | let loop_window = active_loop_window(self.loop_on, self.range, self.loop_trim); | 56 | let loop_window = active_loop_window(self.loop_on, self.range, self.loop_trim); |
| 57 | - if session.is_playing() && should_loop_restart(frame_at(session.now(), fps), loop_window) | 57 | + if session.is_playing() && should_loop_restart(frame_at(session.now(), fps), loop_window) { |
| 58 | - { | ||
| 59 | let start = loop_window.map_or(0, |(lo, _)| lo); | 58 | let start = loop_window.map_or(0, |(lo, _)| lo); |
| 60 | session.seek(f64::from(start) / fps); | 59 | session.seek(f64::from(start) / fps); |
| 61 | } | 60 | } |
crates/app/src/subs.rsmodified+6 -1
| @@ -259,7 +259,12 @@ pub(crate) fn audio_import_tail(path: &std::path::Path, has_video: bool) -> Stri | |||
| 259 | let secs = engine::AudioSession::duration_secs(path).ok().flatten(); | 259 | let secs = engine::AudioSession::duration_secs(path).ok().flatten(); |
| 260 | match (probe, secs) { | 260 | match (probe, secs) { |
| 261 | (Some(p), Some(secs)) => { | 261 | (Some(p), Some(secs)) => { |
| 262 | - format!(" — {} Hz, {} ch, {}s", p.sample_rate, p.channels, secs.round() as u64) | 262 | + format!( |
| 263 | + " — {} Hz, {} ch, {}s", | ||
| 264 | + p.sample_rate, | ||
| 265 | + p.channels, | ||
| 266 | + secs.round() as u64 | ||
| 267 | + ) | ||
| 263 | } | 268 | } |
| 264 | _ => String::new(), | 269 | _ => String::new(), |
| 265 | } | 270 | } |
crates/app/src/tests/cards.rsmodified+23 -7
| @@ -1028,7 +1028,12 @@ fn a_typed_bitrate_is_a_field_and_not_a_key_capture() { | |||
| 1028 | let mut edit = mbps_edit(0); | 1028 | let mut edit = mbps_edit(0); |
| 1029 | edit.digit(0); | 1029 | edit.digit(0); |
| 1030 | assert_eq!(edit.commit(), None); | 1030 | assert_eq!(edit.commit(), None); |
| 1031 | - assert!(edit.refusal.clone().expect("zero says why").contains("0 is not a value")); | 1031 | + assert!( |
| 1032 | + edit.refusal | ||
| 1033 | + .clone() | ||
| 1034 | + .expect("zero says why") | ||
| 1035 | + .contains("0 is not a value") | ||
| 1036 | + ); | ||
| 1032 | assert_eq!(mbps_edit(MBPS_MIN).commit(), Some(MBPS_MIN)); | 1037 | assert_eq!(mbps_edit(MBPS_MIN).commit(), Some(MBPS_MIN)); |
| 1033 | assert_eq!(mbps_edit(MBPS_MAX).commit(), Some(MBPS_MAX)); | 1038 | assert_eq!(mbps_edit(MBPS_MAX).commit(), Some(MBPS_MAX)); |
| 1034 | let mut edit = mbps_edit(0); | 1039 | 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() { | |||
| 1143 | // A plain cut carries neither field, so the row has nothing to show. | 1148 | // A plain cut carries neither field, so the row has nothing to show. |
| 1144 | let plain = clip(0, 10, 0, 0, 0); | 1149 | let plain = clip(0, 10, 0, 0, 0); |
| 1145 | let plain_next = clip(10, 15, 0, 0, 0); | 1150 | let plain_next = clip(10, 15, 0, 0, 0); |
| 1146 | - assert_eq!(transition_of(LaneKind::Video, &plain, Some(&plain_next)), None); | 1151 | + assert_eq!( |
| 1152 | + transition_of(LaneKind::Video, &plain, Some(&plain_next)), | ||
| 1153 | + None | ||
| 1154 | + ); | ||
| 1147 | 1155 | ||
| 1148 | // A dissolve: video lane, `transition_out` set, an adjacent successor. | 1156 | // A dissolve: video lane, `transition_out` set, an adjacent successor. |
| 1149 | // The room offered is the shorter of the two -- here the successor's own | 1157 | // 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() { | |||
| 1506 | (17. + 28. + 15. + 30. + CONTROL_H + 4. + 10. + 24.), | 1514 | (17. + 28. + 15. + 30. + CONTROL_H + 4. + 10. + 24.), |
| 1507 | title + status + summary + CONTROL_H + 4. + gaps + padding | 1515 | title + status + summary + CONTROL_H + 4. + gaps + padding |
| 1508 | ); | 1516 | ); |
| 1509 | - assert!((17. + 28. + 15. + 30. + CONTROL_H + 4. + 10. + 24.) + (8. * KEYS_ROW_H) <= 360., "card too tall"); | 1517 | + assert!( |
| 1518 | + (17. + 28. + 15. + 30. + CONTROL_H + 4. + 10. + 24.) + (8. * KEYS_ROW_H) <= 360., | ||
| 1519 | + "card too tall" | ||
| 1520 | + ); | ||
| 1510 | // The list grows with a window that has the room -- and never shrinks | 1521 | // The list grows with a window that has the room -- and never shrinks |
| 1511 | // below the cap that made the floor fit, whatever arithmetic the window | 1522 | // below the cap that made the floor fit, whatever arithmetic the window |
| 1512 | // hands it. | 1523 | // hands it. |
| 1513 | - let cap = |h: f32| (h - (17. + 28. + 15. + 30. + CONTROL_H + 4. + 10. + 24.) - 24.).max(8. * KEYS_ROW_H); | 1524 | + let cap = |h: f32| { |
| 1525 | + (h - (17. + 28. + 15. + 30. + CONTROL_H + 4. + 10. + 24.) - 24.).max(8. * KEYS_ROW_H) | ||
| 1526 | + }; | ||
| 1514 | assert_eq!(cap(360.), (8. * KEYS_ROW_H)); | 1527 | assert_eq!(cap(360.), (8. * KEYS_ROW_H)); |
| 1515 | assert_eq!(cap(0.), (8. * KEYS_ROW_H)); | 1528 | assert_eq!(cap(0.), (8. * KEYS_ROW_H)); |
| 1516 | assert!(cap(720.) > (8. * KEYS_ROW_H)); | 1529 | assert!(cap(720.) > (8. * KEYS_ROW_H)); |
| @@ -2096,14 +2109,17 @@ fn darkroom_source_rows_keep_proxy_add_and_media_audio_text_paths() { | |||
| 2096 | #[test] | 2109 | #[test] |
| 2097 | fn toggle_proxy_wakes_the_asked_phase_it_stops() { | 2110 | fn toggle_proxy_wakes_the_asked_phase_it_stops() { |
| 2098 | let library = src_text("player/library.rs"); | 2111 | let library = src_text("player/library.rs"); |
| 2099 | - let start = &library[library.find("fn start_proxy_for(").expect("start_proxy_for")..]; | 2112 | + let start = &library[library |
| 2113 | + .find("fn start_proxy_for(") | ||
| 2114 | + .expect("start_proxy_for")..]; | ||
| 2100 | assert!( | 2115 | assert!( |
| 2101 | start.contains("generate_if_wanted(&path, &cancel)"), | 2116 | start.contains("generate_if_wanted(&path, &cancel)"), |
| 2102 | "start_proxy_for no longer hands the header read a cancel flag anyone can reach" | 2117 | "start_proxy_for no longer hands the header read a cancel flag anyone can reach" |
| 2103 | ); | 2118 | ); |
| 2104 | let toggle = &library[library.find("fn toggle_proxy(").expect("toggle_proxy")..]; | 2119 | let toggle = &library[library.find("fn toggle_proxy(").expect("toggle_proxy")..]; |
| 2105 | - let asked_arm = | 2120 | + let asked_arm = &toggle[toggle |
| 2106 | - &toggle[toggle.find("Proxy::Asked(cancel)").expect("the Asked arm's own flag")..]; | 2121 | + .find("Proxy::Asked(cancel)") |
| 2122 | + .expect("the Asked arm's own flag")..]; | ||
| 2107 | assert!( | 2123 | assert!( |
| 2108 | asked_arm.contains("cancel.store(true"), | 2124 | asked_arm.contains("cancel.store(true"), |
| 2109 | "a stop asked during Asked no longer sets the flag the header read polls" | 2125 | "a stop asked during Asked no longer sets the flag the header read polls" |
crates/app/src/tests/layout.rsmodified+6 -2
| @@ -272,11 +272,15 @@ fn a_stateful_button_keeps_its_rect() { | |||
| 272 | // `armed` (whether cancel is armed), and neither may gate its own | 272 | // `armed` (whether cancel is armed), and neither may gate its own |
| 273 | // button out of the tree. | 273 | // button out of the tree. |
| 274 | let cards = src_text("ui/cards.rs"); | 274 | let cards = src_text("ui/cards.rs"); |
| 275 | - for (id, flag) in [("\"eq-spectrum\"", "self.eq_spectrum"), ("\"export-cancel\"", "armed")] { | 275 | + for (id, flag) in [ |
| 276 | + ("\"eq-spectrum\"", "self.eq_spectrum"), | ||
| 277 | + ("\"export-cancel\"", "armed"), | ||
| 278 | + ] { | ||
| 276 | let at = cards.find(id).unwrap_or_else(|| panic!("no {id} button")); | 279 | let at = cards.find(id).unwrap_or_else(|| panic!("no {id} button")); |
| 277 | let before = &cards[at.saturating_sub(350)..at]; | 280 | let before = &cards[at.saturating_sub(350)..at]; |
| 278 | assert!( | 281 | assert!( |
| 279 | - !before.contains(&format!(".when({flag}")) && !before.contains(&format!(".when(!{flag}")), | 282 | + !before.contains(&format!(".when({flag}")) |
| 283 | + && !before.contains(&format!(".when(!{flag}")), | ||
| 280 | "{id} is gated on the very flag it flips -- its rect would move when the state does" | 284 | "{id} is gated on the very flag it flips -- its rect would move when the state does" |
| 281 | ); | 285 | ); |
| 282 | } | 286 | } |
crates/app/src/tests/mod.rsmodified+10 -10
| @@ -22,16 +22,16 @@ use super::{ | |||
| 22 | SPEED_PRESETS, SPEED_STEP, STATUS_ERROR, STATUS_SUCCESS, STATUS_WARNING, SUB_PLAN_CHARS, | 22 | SPEED_PRESETS, SPEED_STEP, STATUS_ERROR, STATUS_SUCCESS, STATUS_WARNING, SUB_PLAN_CHARS, |
| 23 | Source, Speed, StreamInfo, TIMELINE_SHARE, Transport, VOLUME_W, Volume, WAVE_BPS, WAVE_COL, | 23 | Source, Speed, StreamInfo, TIMELINE_SHARE, Transport, VOLUME_W, Volume, WAVE_BPS, WAVE_COL, |
| 24 | WAVE_COLS_MAX, Wave, ZOOM_MIN_FRAMES, active_lane, band_label, bitrate_detail, bitrate_refusal, | 24 | WAVE_COLS_MAX, Wave, ZOOM_MIN_FRAMES, active_lane, band_label, bitrate_detail, bitrate_refusal, |
| 25 | - clipboard_after_remove, color_snap, containers, enable, enable_lane, envelope, | 25 | + clipboard_after_remove, color_snap, containers, enable, enable_lane, envelope, eq_card_w, |
| 26 | - eq_card_w, eq_freq, eq_freq_label, eq_graph_h, eq_spectrum, eq_x, eq_y, estimated_bytes, | 26 | + eq_freq, eq_freq_label, eq_graph_h, eq_spectrum, eq_x, eq_y, estimated_bytes, export_path, |
| 27 | - export_path, export_settings, format_line, format_refusal, fps_choices, fps_label, frac_along, | 27 | + export_settings, format_line, format_refusal, fps_choices, fps_label, frac_along, frac_down, |
| 28 | - frac_down, frame_at, frame_rate_ladder, histogram, inserted_band, is_project, keymap, | 28 | + frame_at, frame_rate_ladder, histogram, inserted_band, is_project, keymap, keys_rows, lanes_h, |
| 29 | - keys_rows, lanes_h, marked, menu_at, menu_items, menu_rows_h, next_container, normalise, | 29 | + marked, menu_at, menu_items, menu_rows_h, next_container, normalise, nothing_to_play, |
| 30 | - nothing_to_play, notice_tone, panel_h, project_path, proxies_to_start, push_notice, px_below, | 30 | + notice_tone, panel_h, project_path, proxies_to_start, push_notice, px_below, retarget, |
| 31 | - retarget, row_enable, row_items, scrub_due, secs_label, should_resync, silence_rate, | 31 | + row_enable, row_items, scrub_due, secs_label, should_resync, silence_rate, size_label, |
| 32 | - size_label, snap_cue, snap_marks, snapped, source_tint, span_partner, speed_at, | 32 | + snap_cue, snap_marks, snapped, source_tint, span_partner, speed_at, sub_pick_after_removal, |
| 33 | - sub_pick_after_removal, subtitle_plan, summary_head, summary_tail, timecode, timeline_fixed_h, | 33 | + subtitle_plan, summary_head, summary_tail, timecode, timeline_fixed_h, tip_may_paint, |
| 34 | - tip_may_paint, transport, typed, unseen_paths, unseen_sources, whole_take, window_title, | 34 | + transport, typed, unseen_paths, unseen_sources, whole_take, window_title, |
| 35 | }; | 35 | }; |
| 36 | 36 | ||
| 37 | use super::{ | 37 | use super::{ |
crates/app/src/tests/view.rsmodified+7 -4
| @@ -136,8 +136,7 @@ fn a_lane_refuses_the_files_it_cannot_hold_before_the_release_says_so() { | |||
| 136 | // ...and a subtitle lane holds none of the three: a caption comes off the | 136 | // ...and a subtitle lane holds none of the three: a caption comes off the |
| 137 | // Subtitles list, which is where the refusal points. | 137 | // Subtitles list, which is where the refusal points. |
| 138 | for (file, has_video) in [(sound, false), (still, true), (movie, true)] { | 138 | for (file, has_video) in [(sound, false), (still, true), (movie, true)] { |
| 139 | - let why = | 139 | + let why = lane_refuses(file, Lane::S1, has_video).expect("a subtitle lane takes no media"); |
| 140 | - lane_refuses(file, Lane::S1, has_video).expect("a subtitle lane takes no media"); | ||
| 141 | assert!(why.starts_with("NOT ON S1 — "), "{why}"); | 140 | assert!(why.starts_with("NOT ON S1 — "), "{why}"); |
| 142 | assert!(why.contains("Subtitles list"), "{why}"); | 141 | assert!(why.contains("Subtitles list"), "{why}"); |
| 143 | } | 142 | } |
| @@ -937,7 +936,9 @@ fn only_tab_is_intercepted_by_a_focused_surface_everything_else_reaches_root() { | |||
| 937 | use crate::ui::stance::is_focus_cycle_key; | 936 | use crate::ui::stance::is_focus_cycle_key; |
| 938 | 937 | ||
| 939 | assert!(is_focus_cycle_key("tab")); | 938 | assert!(is_focus_cycle_key("tab")); |
| 940 | - for key in ["space", "escape", "s", "c", "left", "right", "enter", "delete", "?"] { | 939 | + for key in [ |
| 940 | + "space", "escape", "s", "c", "left", "right", "enter", "delete", "?", | ||
| 941 | + ] { | ||
| 941 | assert!(!is_focus_cycle_key(key), "{key} must bubble to the root"); | 942 | assert!(!is_focus_cycle_key(key), "{key} must bubble to the root"); |
| 942 | } | 943 | } |
| 943 | } | 944 | } |
| @@ -952,7 +953,9 @@ fn escape_is_the_only_key_a_focused_surface_uses_to_leave_the_ring() { | |||
| 952 | use crate::ui::stance::is_focus_exit_key; | 953 | use crate::ui::stance::is_focus_exit_key; |
| 953 | 954 | ||
| 954 | assert!(is_focus_exit_key("escape")); | 955 | assert!(is_focus_exit_key("escape")); |
| 955 | - for key in ["tab", "space", "s", "c", "left", "right", "enter", "delete", "?"] { | 956 | + for key in [ |
| 957 | + "tab", "space", "s", "c", "left", "right", "enter", "delete", "?", | ||
| 958 | + ] { | ||
| 956 | assert!(!is_focus_exit_key(key), "{key} must not exit the ring"); | 959 | assert!(!is_focus_exit_key(key), "{key} must not exit the ring"); |
| 957 | } | 960 | } |
| 958 | } | 961 | } |
crates/app/src/timeline_math.rsmodified+0 -1
| @@ -427,7 +427,6 @@ pub(crate) fn sub_mark(subs: &[SubClip], start: u32) -> Option<usize> { | |||
| 427 | subs.iter().position(|s| s.start == start) | 427 | subs.iter().position(|s| s.start == start) |
| 428 | } | 428 | } |
| 429 | 429 | ||
| 430 | - | ||
| 431 | /// Scales an envelope to its own loudest sample, so a quietly mastered source | 430 | /// Scales an envelope to its own loudest sample, so a quietly mastered source |
| 432 | /// still draws as a shape. The fixtures peak around an eighth of full scale, and | 431 | /// still draws as a shape. The fixtures peak around an eighth of full scale, and |
| 433 | /// an eighth of a 30 px lane is a flat line -- which says "silent" about a file | 432 | /// an eighth of a 30 px lane is a flat line -- which says "silent" about a file |
crates/app/src/ui/bench_stance.rsmodified+16 -4
| @@ -1048,7 +1048,10 @@ fn lane_row( | |||
| 1048 | ) | 1048 | ) |
| 1049 | .drag_over::<AssetDrag>(|d, _, _, _| d.bg(rgb(DARK_RAISED()))) | 1049 | .drag_over::<AssetDrag>(|d, _, _, _| d.bg(rgb(DARK_RAISED()))) |
| 1050 | .on_drop(cx.listener(move |this, drag: &AssetDrag, window, cx| { | 1050 | .on_drop(cx.listener(move |this, drag: &AssetDrag, window, cx| { |
| 1051 | - let x = this.drag_x.take().unwrap_or_else(|| window.mouse_position().x); | 1051 | + let x = this |
| 1052 | + .drag_x | ||
| 1053 | + .take() | ||
| 1054 | + .unwrap_or_else(|| window.mouse_position().x); | ||
| 1052 | let at = this.place_frame(x).0; | 1055 | let at = this.place_frame(x).0; |
| 1053 | this.insert_source(&drag.0.clone(), drag.1, Some(lane), Some(at), cx) | 1056 | this.insert_source(&drag.0.clone(), drag.1, Some(lane), Some(at), cx) |
| 1054 | })) | 1057 | })) |
| @@ -1090,7 +1093,10 @@ fn lane_row( | |||
| 1090 | let Some(idx) = this.dragged(drag) else { | 1093 | let Some(idx) = this.dragged(drag) else { |
| 1091 | return; | 1094 | return; |
| 1092 | }; | 1095 | }; |
| 1093 | - let x = this.drag_x.take().unwrap_or_else(|| window.mouse_position().x); | 1096 | + let x = this |
| 1097 | + .drag_x | ||
| 1098 | + .take() | ||
| 1099 | + .unwrap_or_else(|| window.mouse_position().x); | ||
| 1094 | this.move_clip(drag.lane, idx, lane, x, cx) | 1100 | this.move_clip(drag.lane, idx, lane, x, cx) |
| 1095 | })) | 1101 | })) |
| 1096 | .on_drag_move( | 1102 | .on_drag_move( |
| @@ -1108,7 +1114,10 @@ fn lane_row( | |||
| 1108 | // the same call `ui/timeline.rs`'s own bed makes). | 1114 | // the same call `ui/timeline.rs`'s own bed makes). |
| 1109 | .drag_over::<SubDrag>(|d, _, _, _| d.bg(rgb(DARK_RAISED()))) | 1115 | .drag_over::<SubDrag>(|d, _, _, _| d.bg(rgb(DARK_RAISED()))) |
| 1110 | .on_drop(cx.listener(move |this, drag: &SubDrag, window, cx| { | 1116 | .on_drop(cx.listener(move |this, drag: &SubDrag, window, cx| { |
| 1111 | - let x = this.drag_x.take().unwrap_or_else(|| window.mouse_position().x); | 1117 | + let x = this |
| 1118 | + .drag_x | ||
| 1119 | + .take() | ||
| 1120 | + .unwrap_or_else(|| window.mouse_position().x); | ||
| 1112 | this.move_sub(drag, lane, x, cx); | 1121 | this.move_sub(drag, lane, x, cx); |
| 1113 | })) | 1122 | })) |
| 1114 | .on_drag_move( | 1123 | .on_drag_move( |
| @@ -1123,7 +1132,10 @@ fn lane_row( | |||
| 1123 | ) | 1132 | ) |
| 1124 | .drag_over::<SubPick>(|d, _, _, _| d.bg(rgb(DARK_RAISED()))) | 1133 | .drag_over::<SubPick>(|d, _, _, _| d.bg(rgb(DARK_RAISED()))) |
| 1125 | .on_drop(cx.listener(move |this, drag: &SubPick, window, cx| { | 1134 | .on_drop(cx.listener(move |this, drag: &SubPick, window, cx| { |
| 1126 | - let x = this.drag_x.take().unwrap_or_else(|| window.mouse_position().x); | 1135 | + let x = this |
| 1136 | + .drag_x | ||
| 1137 | + .take() | ||
| 1138 | + .unwrap_or_else(|| window.mouse_position().x); | ||
| 1127 | this.place_sub(drag.0, lane, x, cx); | 1139 | this.place_sub(drag.0, lane, x, cx); |
| 1128 | })) | 1140 | })) |
| 1129 | .on_drag_move( | 1141 | .on_drag_move( |
crates/app/src/ui/stance.rsmodified+6 -4
| @@ -42,7 +42,11 @@ const SURFACE_CYCLE: [Surface; 3] = [Surface::Dock, Surface::Bench, Surface::Ins | |||
| 42 | pub(crate) fn next_surface(current: Surface, backward: bool) -> Surface { | 42 | pub(crate) fn next_surface(current: Surface, backward: bool) -> Surface { |
| 43 | let i = SURFACE_CYCLE.iter().position(|&s| s == current).unwrap(); | 43 | let i = SURFACE_CYCLE.iter().position(|&s| s == current).unwrap(); |
| 44 | let n = SURFACE_CYCLE.len(); | 44 | let n = SURFACE_CYCLE.len(); |
| 45 | - SURFACE_CYCLE[if backward { (i + n - 1) % n } else { (i + 1) % n }] | 45 | + SURFACE_CYCLE[if backward { |
| 46 | + (i + n - 1) % n | ||
| 47 | + } else { | ||
| 48 | + (i + 1) % n | ||
| 49 | + }] | ||
| 46 | } | 50 | } |
| 47 | 51 | ||
| 48 | /// The one key a surface's own `on_key_down` answers. Everything else is | 52 | /// The one key a surface's own `on_key_down` answers. Everything else is |
| @@ -396,9 +400,7 @@ fn ghost( | |||
| 396 | .rounded(px(3.)) | 400 | .rounded(px(3.)) |
| 397 | .cursor_pointer() | 401 | .cursor_pointer() |
| 398 | .hover(|s| s.bg(rgb(DARK_RAISED())).text_color(rgb(INK1()))) | 402 | .hover(|s| s.bg(rgb(DARK_RAISED())).text_color(rgb(INK1()))) |
| 399 | - .on_click(cx.listener(move |this, _: &ClickEvent, window, cx| { | 403 | + .on_click(cx.listener(move |this, _: &ClickEvent, window, cx| this.act(action, window, cx))) |
| 400 | - this.act(action, window, cx) | ||
| 401 | - })) | ||
| 402 | .type_style(type_scale::label( | 404 | .type_style(type_scale::label( |
| 403 | type_scale::LABEL_ROW_PX, | 405 | type_scale::LABEL_ROW_PX, |
| 404 | gpui::FontWeight::MEDIUM, | 406 | gpui::FontWeight::MEDIUM, |
crates/app/src/ui/widgets.rsmodified+8 -2
| @@ -315,7 +315,10 @@ impl NumberEdit { | |||
| 315 | /// past. | 315 | /// past. |
| 316 | pub(crate) fn digit(&mut self, digit: u32) { | 316 | pub(crate) fn digit(&mut self, digit: u32) { |
| 317 | if self.text.chars().count() >= self.digits { | 317 | if self.text.chars().count() >= self.digits { |
| 318 | - self.refusal = Some(format!("{} digits is already past the ceiling", self.digits)); | 318 | + self.refusal = Some(format!( |
| 319 | + "{} digits is already past the ceiling", | ||
| 320 | + self.digits | ||
| 321 | + )); | ||
| 319 | return; | 322 | return; |
| 320 | } | 323 | } |
| 321 | match char::from_digit(digit, 10) { | 324 | match char::from_digit(digit, 10) { |
| @@ -370,7 +373,10 @@ impl NumberEdit { | |||
| 370 | None | 373 | None |
| 371 | } | 374 | } |
| 372 | Ok(v) => { | 375 | Ok(v) => { |
| 373 | - self.refusal = Some(format!("{v} is past the {} {} ceiling", self.max, self.unit)); | 376 | + self.refusal = Some(format!( |
| 377 | + "{v} is past the {} {} ceiling", | ||
| 378 | + self.max, self.unit | ||
| 379 | + )); | ||
| 374 | None | 380 | None |
| 375 | } | 381 | } |
| 376 | Err(_) => { | 382 | Err(_) => { |
crates/app/src/viewport.rsmodified+0 -1
| @@ -2,7 +2,6 @@ | |||
| 2 | 2 | ||
| 3 | use crate::*; | 3 | use crate::*; |
| 4 | 4 | ||
| 5 | - | ||
| 6 | /// A span of seconds as a person reads it: one decimal above a second, two | 5 | /// A span of seconds as a person reads it: one decimal above a second, two |
| 7 | /// below -- [`scaled`]'s rule, for its reason. The tightest zoom is | 6 | /// below -- [`scaled`]'s rule, for its reason. The tightest zoom is |
| 8 | /// [`ZOOM_MIN_FRAMES`] across the bed, which on the 240 fps slow-motion a phone | 7 | /// [`ZOOM_MIN_FRAMES`] across the bed, which on the 240 fps slow-motion a phone |