From f2409f2605f6078ed4536433bd647fa3ae83ce04 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Sun, 14 Dec 2025 12:21:46 -0700 Subject: [PATCH] Run cargo fmt --- crates/gpui/src/app/test_app.rs | 19 +++++++++---------- crates/gpui/src/app/test_context.rs | 6 +++--- crates/gpui/src/scene.rs | 20 ++++++++++++-------- 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/crates/gpui/src/app/test_app.rs b/crates/gpui/src/app/test_app.rs index b75a11bb35963a3d452ef1655ff0dd9ef1edfb55..abeaec230abf9af83fe72f2eec11e061c73b1e6b 100644 --- a/crates/gpui/src/app/test_app.rs +++ b/crates/gpui/src/app/test_app.rs @@ -29,8 +29,7 @@ use crate::{ Bounds, ClipboardItem, Context, Entity, ForegroundExecutor, Global, InputEvent, Keystroke, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, Pixels, Platform, Point, Render, SceneSnapshot, Size, Task, TestDispatcher, TestPlatform, TextSystem, Window, WindowBounds, - WindowHandle, WindowOptions, - app::GpuiMode, + WindowHandle, WindowOptions, app::GpuiMode, }; use rand::{SeedableRng, rngs::StdRng}; use std::{future::Future, rc::Rc, sync::Arc, time::Duration}; @@ -114,7 +113,11 @@ impl TestApp { } /// Read an entity. - pub fn read_entity(&self, entity: &Entity, f: impl FnOnce(&T, &App) -> R) -> R { + pub fn read_entity( + &self, + entity: &Entity, + f: impl FnOnce(&T, &App) -> R, + ) -> R { self.read(|cx| f(entity.read(cx), cx)) } @@ -304,9 +307,7 @@ impl TestWindow { let mut app = self.app.borrow_mut(); let any_handle: AnyWindowHandle = self.handle.into(); app.update_window(any_handle, |root_view, _, _| { - root_view - .downcast::() - .expect("root view type mismatch") + root_view.downcast::().expect("root view type mismatch") }) .expect("window not found") } @@ -318,9 +319,7 @@ impl TestWindow { let mut app = self.app.borrow_mut(); let any_handle: AnyWindowHandle = self.handle.into(); app.update_window(any_handle, |root_view, window, cx| { - let view = root_view - .downcast::() - .expect("root view type mismatch"); + let view = root_view.downcast::().expect("root view type mismatch"); view.update(cx, |view, cx| f(view, window, cx)) }) .expect("window not found") @@ -499,7 +498,7 @@ impl Clone for TestWindow { #[cfg(test)] mod tests { use super::*; - use crate::{div, prelude::*, Focusable, FocusHandle}; + use crate::{FocusHandle, Focusable, div, prelude::*}; struct Counter { count: usize, diff --git a/crates/gpui/src/app/test_context.rs b/crates/gpui/src/app/test_context.rs index 2cc3c1b3255f9b0f3874d232e181423ef12b77b1..7cbb65f762e5ab1e1326d1a872443b17dea991e8 100644 --- a/crates/gpui/src/app/test_context.rs +++ b/crates/gpui/src/app/test_context.rs @@ -3,9 +3,9 @@ use crate::{ BackgroundExecutor, BorrowAppContext, Bounds, Capslock, ClipboardItem, DrawPhase, Drawable, Element, Empty, EventEmitter, ForegroundExecutor, Global, InputEvent, Keystroke, Modifiers, ModifiersChangedEvent, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, Pixels, - Platform, Point, Render, Result, Size, Task, TestDispatcher, TestPlatform, - TestScreenCaptureSource, TestPlatformWindow, TextSystem, VisualContext, Window, WindowBounds, - WindowHandle, WindowOptions, app::GpuiMode, + Platform, Point, Render, Result, Size, Task, TestDispatcher, TestPlatform, TestPlatformWindow, + TestScreenCaptureSource, TextSystem, VisualContext, Window, WindowBounds, WindowHandle, + WindowOptions, app::GpuiMode, }; use anyhow::{anyhow, bail}; use futures::{Stream, StreamExt, channel::oneshot}; diff --git a/crates/gpui/src/scene.rs b/crates/gpui/src/scene.rs index 04db1794fe896b1f85c419815cb2a60bd21c9421..046395b1c41bd76640e5f873a2de66b925e9e3a3 100644 --- a/crates/gpui/src/scene.rs +++ b/crates/gpui/src/scene.rs @@ -231,21 +231,25 @@ impl Scene { /// Create a snapshot of the scene for testing. #[cfg(any(test, feature = "test-support"))] pub fn snapshot(&self) -> SceneSnapshot { - let quads = self.quads.iter().map(|q| { - RenderedQuad { + let quads = self + .quads + .iter() + .map(|q| RenderedQuad { bounds: q.bounds, background_color: q.background.as_solid(), border_color: q.border_color, - } - }).collect(); + }) + .collect(); - let glyphs = self.monochrome_sprites.iter().map(|s| { - RenderedGlyph { + let glyphs = self + .monochrome_sprites + .iter() + .map(|s| RenderedGlyph { origin: s.bounds.origin, size: s.bounds.size, color: s.color, - } - }).collect(); + }) + .collect(); SceneSnapshot { quads,