diff --git a/crates/behavior/src/dock/apply.rs b/crates/behavior/src/dock/apply.rs index d0e6a2a73..4772f014c 100644 --- a/crates/behavior/src/dock/apply.rs +++ b/crates/behavior/src/dock/apply.rs @@ -71,9 +71,7 @@ impl Layout

{ let allowed = policy.movable && match to { Target::Float { .. } => policy.floatable, - Target::At { anchor, placement } => { - placement.allowed_by(permissions(anchor)) && (!floats(anchor) || policy.floatable) - } + Target::At { anchor, placement } => placement.allowed_by(permissions(anchor)) && (!floats(anchor) || policy.floatable), Target::NewDock { .. } => true, }; if !allowed { diff --git a/crates/ui-canvas/tests/it/canvas/raster.rs b/crates/ui-canvas/tests/it/canvas/raster.rs index 79c44ae0f..e6c41207f 100644 --- a/crates/ui-canvas/tests/it/canvas/raster.rs +++ b/crates/ui-canvas/tests/it/canvas/raster.rs @@ -143,7 +143,11 @@ fn the_checkerboard_starts_with_a_light_cell_at_the_document_corner() { let at_corner = checker.vertices.iter().find(|vertex| vertex.pos.distance(corner) < 0.5).expect("a checkerboard corner at the document's"); let whole = |v: f32| (v - v.round()).abs() < 1e-3; // The texture repeats every two cells, light first: a whole texture coordinate is a light cell's top-left. - assert!(whole(at_corner.uv.x) && whole(at_corner.uv.y), "{width} x {height} at {zoom}: a light cell starts at the document's corner: {:?}", at_corner.uv); + assert!( + whole(at_corner.uv.x) && whole(at_corner.uv.y), + "{width} x {height} at {zoom}: a light cell starts at the document's corner: {:?}", + at_corner.uv + ); } } diff --git a/crates/ui-canvas/tests/it/canvas/tool.rs b/crates/ui-canvas/tests/it/canvas/tool.rs index 7427a038c..c4844b832 100644 --- a/crates/ui-canvas/tests/it/canvas/tool.rs +++ b/crates/ui-canvas/tests/it/canvas/tool.rs @@ -19,10 +19,10 @@ use craft_ui::runtime::commands::{CommandGate, CommandSet as _}; use craft_ui::runtime::frame; use craft_ui::runtime::windows::WindowHost; use craft_ui::style::DataColor; -use craft_ui::text::NumberField; use craft_ui::testing::input::key_press; use craft_ui::testing::layout::in_region; use craft_ui::testing::{Fixture, ToolFixture, pointer, trial}; +use craft_ui::text::NumberField; use egui::{Color32, Id, Key, Modifiers, Pos2, Rect, Shape, Vec2}; use std::cell::{Cell, RefCell}; use std::rc::Rc; diff --git a/crates/ui-contract/src/runtime/commands/board.rs b/crates/ui-contract/src/runtime/commands/board.rs index 8dfa847d2..f33b47ebb 100644 --- a/crates/ui-contract/src/runtime/commands/board.rs +++ b/crates/ui-contract/src/runtime/commands/board.rs @@ -1202,7 +1202,8 @@ pub(crate) fn begin(ctx: &Context) { } } _ => { - let Some(hit) = keys.press(&shortcuts.layout, &shortcut.input, shortcuts.typing && !shortcut.canvas, Some((&mut matcher, now))) else { + let Some(hit) = keys.press(&shortcuts.layout, &shortcut.input, shortcuts.typing && !shortcut.canvas, Some((&mut matcher, now))) + else { continue; }; let (app, instance) = with(ctx, |board| board.target_of(ctx, &hit.command, &board.here)); diff --git a/crates/ui-contract/src/runtime/keys.rs b/crates/ui-contract/src/runtime/keys.rs index d3ba9f78d..f9a17bf0f 100644 --- a/crates/ui-contract/src/runtime/keys.rs +++ b/crates/ui-contract/src/runtime/keys.rs @@ -40,7 +40,8 @@ pub use intents::settle; pub use intents::take_submit; pub use intents::with_window_intents; pub(crate) use intents::{ - Lent, context_part, context_request, give_back, lend, request_context, route_whole_reset, scope_escape, take_cancel, take_every_escape, take_window_cancel, + Lent, context_part, context_request, give_back, lend, request_context, route_whole_reset, scope_escape, take_cancel, take_every_escape, + take_window_cancel, }; pub(crate) use nodes::{redirect_node, register_expanded, register_node}; pub use route::focus_holds; diff --git a/crates/ui-contract/src/runtime/pointer.rs b/crates/ui-contract/src/runtime/pointer.rs index 768d6293e..43d3814c2 100644 --- a/crates/ui-contract/src/runtime/pointer.rs +++ b/crates/ui-contract/src/runtime/pointer.rs @@ -704,9 +704,11 @@ fn layer_past_window(ctx: &Context, viewport: ViewportId, at: Pos2) -> Option::with(ctx, viewport, |record| { record.last.get(layer).is_some_and(|roots| { roots.values().any(|entry| { - entry.shapes.iter().zip(&entry.placed).any(|(shape, placed)| { - shape.sense.takes_press() && shape.hits(point) && shape.shape.bounds().intersects(placed.clip) - }) + entry + .shapes + .iter() + .zip(&entry.placed) + .any(|(shape, placed)| shape.sense.takes_press() && shape.hits(point) && shape.shape.bounds().intersects(placed.clip)) }) }) }) @@ -735,7 +737,9 @@ fn diag_layers(ctx: &Context, viewport: ViewportId, at: Pos2, chosen: Layer, tes .iter() .zip(&entry.placed) .filter(|(shape, _)| shape.hits(point)) - .map(|(shape, placed)| format!("{} {:?} {:?} clip_in {}", diag_id(shape.owner), shape.part, shape.sense, placed.clip.contains(point))) + .map(|(shape, placed)| { + format!("{} {:?} {:?} clip_in {}", diag_id(shape.owner), shape.part, shape.sense, placed.clip.contains(point)) + }) .collect(); format!("root {} shapes {} under {under:?}", diag_id(*root), entry.shapes.len()) }) diff --git a/crates/ui-panels/src/docking/group.rs b/crates/ui-panels/src/docking/group.rs index 75df9d0cf..ed67a5f33 100644 --- a/crates/ui-panels/src/docking/group.rs +++ b/crates/ui-panels/src/docking/group.rs @@ -8,9 +8,9 @@ use super::words::DockWords; use super::{PanelDrag, PanelKey, PanelTitle}; use crate::buttons::IconButton; use crate::contract::{ - Access, Bind, BindMut, BodyCx, Common, Component, Container, ContainerProps, ContextMenuRequest, Cx, HeaderEdge, HeaderParts, HeaderRegion, ListDrag, MeasureCx, - Name, Outcome, OverlayUi, Overlays as _, PaintUi, PartsCx, Pointer as _, PopupKind, Props as _, Role, ShowCollection as _, ShowContainer as _, - Sizing, WordSetCx as _, + Access, Bind, BindMut, BodyCx, Common, Component, Container, ContainerProps, ContextMenuRequest, Cx, HeaderEdge, HeaderParts, HeaderRegion, + ListDrag, MeasureCx, Name, Outcome, OverlayUi, Overlays as _, PaintUi, PartsCx, Pointer as _, PopupKind, Props as _, Role, ShowCollection as _, + ShowContainer as _, Sizing, WordSetCx as _, }; use crate::menu::{GroupItem, Menu, PanelMenu, PanelRow}; use crate::runtime::commands::{CommandSet as _, CommandState, Commands as _}; diff --git a/crates/ui-panels/src/rails/tool/trials.rs b/crates/ui-panels/src/rails/tool/trials.rs index 7b4702b97..0370537ff 100644 --- a/crates/ui-panels/src/rails/tool/trials.rs +++ b/crates/ui-panels/src/rails/tool/trials.rs @@ -4,8 +4,8 @@ use super::stories::tools; use super::{LastUsed, ToolRail, ToolSlot}; use crate::buttons::Button; -use crate::contract::Show as _; use crate::contract::Props as _; +use crate::contract::Show as _; use crate::testing::pointer::{moved, wheel}; use crate::testing::relations::{above, grows_with}; use crate::testing::{Fixture, trial}; diff --git a/crates/ui-panels/tests/it/dialogs.rs b/crates/ui-panels/tests/it/dialogs.rs index d0186d59f..52f8d83aa 100644 --- a/crates/ui-panels/tests/it/dialogs.rs +++ b/crates/ui-panels/tests/it/dialogs.rs @@ -6,8 +6,8 @@ use craft_quit::{CloseAnswer, CloseScope}; use craft_ui::contract::{Common, Component, Cx, MeasureCx, PartsCx, Props as _, Role, Show as _, ShowContainer as _}; use craft_ui::dialog::stories::hosted; use craft_ui::dialog::{ - Alert, Dialog, DialogHost, DialogId, DialogResult, DialogStack, HostedAlert, PromptKind, StackDialog, StandardPrompt, StartupStage, UnsavedChangesDialog, - dialog_id, + Alert, Dialog, DialogHost, DialogId, DialogResult, DialogStack, HostedAlert, PromptKind, StackDialog, StandardPrompt, StartupStage, + UnsavedChangesDialog, dialog_id, }; use craft_ui::runtime::windows::{WindowHit, WindowHost}; use craft_ui::sections::{DialogRole, FooterButton}; diff --git a/crates/ui-widgets/src/tile_grid/grid.rs b/crates/ui-widgets/src/tile_grid/grid.rs index 5258a2cca..f02ea9d77 100644 --- a/crates/ui-widgets/src/tile_grid/grid.rs +++ b/crates/ui-widgets/src/tile_grid/grid.rs @@ -150,11 +150,8 @@ struct GridSizes { impl GridSizes { fn of(cx: &StyleCx<'_>, card: bool, rows: RowHeight) -> GridSizes { - let spacing = ArrangeSpacing::new( - if card { cx.tokens.space.gap.section } else { cx.tokens.space.gap.stack }, - cx.tokens.space.gap.inline, - rows.of(cx), - ); + let spacing = + ArrangeSpacing::new(if card { cx.tokens.space.gap.section } else { cx.tokens.space.gap.stack }, cx.tokens.space.gap.inline, rows.of(cx)); GridSizes { card: cx.tokens.size.thumb.card, thumbs: [cx.tokens.size.thumb.sm, cx.tokens.size.thumb.md, cx.tokens.size.thumb.lg],