From 80c1ff2d4a4c2213dfd328a646afeebf4fb0a730 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 19 Nov 2026 18:25:32 -0500 Subject: [PATCH] rustfmt framework batch 4 --- crates/menu/src/mac.rs | 7 +++---- crates/pages/src/ui/view.rs | 15 ++++++++------- crates/review/src/ui/annotate/tool.rs | 7 ++----- crates/review/tests/it/annotate.rs | 11 ++++------- crates/review/tests/it/comments.rs | 10 ++-------- crates/ui-contract/src/primitives/text_adapter.rs | 3 ++- .../ui-patterns/tests/it/form_dialogs/dialog.rs | 9 ++++----- 7 files changed, 25 insertions(+), 37 deletions(-) diff --git a/crates/menu/src/mac.rs b/crates/menu/src/mac.rs index 8193ff2c8..37cc63e14 100644 --- a/crates/menu/src/mac.rs +++ b/crates/menu/src/mac.rs @@ -174,10 +174,9 @@ fn lower_nodes(nodes: &[Node], targets: &mut HashMap) -> Vec native::Node::Separator, // A native submenu is disabled while it has no children: a disabled one goes over empty. - Node::Submenu { label, children, enabled, .. } => native::Node::Submenu { - label: label.clone(), - children: if *enabled { lower_nodes(children, targets) } else { Vec::new() }, - }, + Node::Submenu { label, children, enabled, .. } => { + native::Node::Submenu { label: label.clone(), children: if *enabled { lower_nodes(children, targets) } else { Vec::new() } } + } Node::Standard { kind, label } => native::Node::Platform { kind: match kind { Standard::Services => native::Platform::Services, diff --git a/crates/pages/src/ui/view.rs b/crates/pages/src/ui/view.rs index fdeea54e8..f9d23421c 100644 --- a/crates/pages/src/ui/view.rs +++ b/crates/pages/src/ui/view.rs @@ -450,8 +450,12 @@ impl<'a> PageView<'a> { // The canvas keeps the view inside the shown row, as the pass does, so a wheel share that cannot pan a row at its // edge leaves the gesture unmoved and a page turn can follow it. navigation.overscroll = false; - let canvas = - Canvas::new(label.clone()).view(given).navigation(navigation).keys_to_body(true).body_nudges(KeyMoves::NUDGES).document(frame.document(&geo)); + let canvas = Canvas::new(label.clone()) + .view(given) + .navigation(navigation) + .keys_to_body(true) + .body_nudges(KeyMoves::NUDGES) + .document(frame.document(&geo)); let mut held = Held::new(Bind::bound(state)); let mut seen: Option = None; let mut canvas_body = |ui: &mut Ui, cx: &mut BodyCx<'_>| { @@ -983,11 +987,8 @@ struct KeyMoves { impl KeyMoves { /// The arrow modifiers `of` reads besides the plain arrows: Cmd or Ctrl, alone or with Shift. Alt is the app's. - const NUDGES: NudgeMods = NudgeMods::NONE - .with(Mods::CMD) - .with(Mods::CTRL) - .with(Mods { shift: true, ..Mods::CMD }) - .with(Mods { shift: true, ..Mods::CTRL }); + const NUDGES: NudgeMods = + NudgeMods::NONE.with(Mods::CMD).with(Mods::CTRL).with(Mods { shift: true, ..Mods::CMD }).with(Mods { shift: true, ..Mods::CTRL }); /// Page Up and Down a screen less a key line (a row when not continuous, and with Cmd), Home and End the first /// and last page, Up and Down a key line (not continuous, a turn once the row is at its edge that way), Left and diff --git a/crates/review/src/ui/annotate/tool.rs b/crates/review/src/ui/annotate/tool.rs index 34c084b7f..41b0be45c 100644 --- a/crates/review/src/ui/annotate/tool.rs +++ b/crates/review/src/ui/annotate/tool.rs @@ -847,11 +847,8 @@ impl AnnotateTool { // shape without adding one. self.finish_poly(kind, &reading.words); } else { - let next = if pointer.mods.shift { - self.poly.last().map_or(at, |&last| self.select_options.shift_lock.apply(last, at)) - } else { - at - }; + let next = + if pointer.mods.shift { self.poly.last().map_or(at, |&last| self.select_options.shift_lock.apply(last, at)) } else { at }; let repeat = reading.view.doc_len(REPEAT_POINT); if !self.poly.last().is_some_and(|&last| (last - next).hypot() < repeat) { self.poly.push(next); diff --git a/crates/review/tests/it/annotate.rs b/crates/review/tests/it/annotate.rs index 02d6f6f52..fd59f6fea 100644 --- a/crates/review/tests/it/annotate.rs +++ b/crates/review/tests/it/annotate.rs @@ -691,9 +691,9 @@ fn place_and_erase_drags_paint_their_preview_while_held() { let held_shapes = callout_rig.fixture().frame_shapes(); let held_paths = colored_paths(&held_shapes, stroke_color); assert!( - held_paths - .iter() - .any(|p| p.points.len() == 2 && (p.points[0] - on_screen(&callout_rig, from)).length() < 0.5 && (p.points[1] - on_screen(&callout_rig, to)).length() < 0.5), + held_paths.iter().any(|p| p.points.len() == 2 + && (p.points[0] - on_screen(&callout_rig, from)).length() < 0.5 + && (p.points[1] - on_screen(&callout_rig, to)).length() < 0.5), "Callout drag paints its leader preview while held: {held_paths:?}" ); release_drag(&mut callout_rig, to, Modifiers::NONE); @@ -718,10 +718,7 @@ fn place_and_erase_drags_paint_their_preview_while_held() { hold_drag(&mut eraser_rig, Point::new(60.0, 100.0), Point::new(220.0, 100.0), Modifiers::NONE); let held_shapes = eraser_rig.fixture().frame_shapes(); assert_eq!(swath_widths(&held_shapes).len(), 1, "radius {radius}: swath painted at twice the radius while held"); - let cap_circles = held_shapes - .iter() - .filter(|shape| matches!(shape, Shape::Circle(c) if (c.radius - radius).abs() < 0.1)) - .count(); + let cap_circles = held_shapes.iter().filter(|shape| matches!(shape, Shape::Circle(c) if (c.radius - radius).abs() < 0.1)).count(); assert!(cap_circles >= 2, "radius {radius}: swath paints round dots along its path: {cap_circles}"); release_drag(&mut eraser_rig, Point::new(220.0, 100.0), Modifiers::NONE); let after_shapes = eraser_rig.fixture().frame_shapes(); diff --git a/crates/review/tests/it/comments.rs b/crates/review/tests/it/comments.rs index 00976bd8a..9ae665e7a 100644 --- a/crates/review/tests/it/comments.rs +++ b/crates/review/tests/it/comments.rs @@ -412,14 +412,8 @@ fn a_heading_puts_its_count_in_its_access_name() { }); fixture.in_room(Room::Panel).settle(); let names = row_names(&fixture); - assert!( - names.iter().any(|name| name.contains("Page 1") && name.contains('3')), - "Page 1's heading carries its unfiltered count 3: {names:?}" - ); - assert!( - names.iter().any(|name| name.contains("Page 2") && name.contains('1')), - "Page 2's heading carries its unfiltered count 1: {names:?}" - ); + assert!(names.iter().any(|name| name.contains("Page 1") && name.contains('3')), "Page 1's heading carries its unfiltered count 3: {names:?}"); + assert!(names.iter().any(|name| name.contains("Page 2") && name.contains('1')), "Page 2's heading carries its unfiltered count 1: {names:?}"); state.borrow_mut().sort = CommentSort::Type; fixture.settle(); diff --git a/crates/ui-contract/src/primitives/text_adapter.rs b/crates/ui-contract/src/primitives/text_adapter.rs index ee963cc65..1e5235865 100644 --- a/crates/ui-contract/src/primitives/text_adapter.rs +++ b/crates/ui-contract/src/primitives/text_adapter.rs @@ -373,7 +373,8 @@ pub(crate) fn run(state: &mut TextState, mut input: AdapterIn<'_>) -> AdapterOut // A clearing field takes Escape while it shows text, with or without a draft, and passes it on once it is empty. In // a dialog a draft leaves Escape to the dialog's Cancel, which discards it with the dialog's other edits. let draft_takes = state.draft.is_some() && !(focused_before && keys::focus_in_dialog(ctx)); - let takes_escape = if input.options.clear_on_escape { !base.is_empty() || state.preedit.is_some() } else { draft_takes || state.preedit.is_some() }; + let takes_escape = + if input.options.clear_on_escape { !base.is_empty() || state.preedit.is_some() } else { draft_takes || state.preedit.is_some() }; if focused_before && takes_escape && !state.completions.open && !input.list_open && input.intents.take(Intent::Cancel) { // Escape over a composition alone ends the composition and leaves the text. if state.draft.is_some() || state.preedit.is_none() { diff --git a/crates/ui-patterns/tests/it/form_dialogs/dialog.rs b/crates/ui-patterns/tests/it/form_dialogs/dialog.rs index 8c2dc52bd..f871fcb89 100644 --- a/crates/ui-patterns/tests/it/form_dialogs/dialog.rs +++ b/crates/ui-patterns/tests/it/form_dialogs/dialog.rs @@ -813,14 +813,13 @@ fn escape_in_a_text_field_closes_the_form_dialog_typed_or_not() { let mut fixture = Fixture::new(move |ui| { let mut is_open = shown.get(); let mut text = value.borrow_mut(); - let out = craft_ui::patterns::form_dialogs::FormDialog::new("Protect", Bind::bound(&mut *text)).opened(Bind::bound(&mut is_open)).show( - ui, - |ui, _, text| { + let out = craft_ui::patterns::form_dialogs::FormDialog::new("Protect", Bind::bound(&mut *text)) + .opened(Bind::bound(&mut is_open)) + .show(ui, |ui, _, text| { let field = craft_ui::text::TextField::new("Type Password", Bind::bound(text)); let _ = if masked { field.masked() } else { field }.show(ui); true - }, - ); + }); shown.set(is_open); seen.set(seen.get() || out.closed.is_some()); });