From 81d0f5f5ddf2d603bf03fd111aafb7f07ca97041 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Sat, 10 Oct 2026 02:30:48 -0400 Subject: [PATCH] Format: the update dialog, toast and feedback tests pass cargo fmt Co-Authored-By: Claude Opus 5.5 --- src/feedback/tests/mod.rs | 14 ++++++++++++-- src/feedback/toast.rs | 4 +++- src/shell/update.rs | 11 +++++++++-- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/feedback/tests/mod.rs b/src/feedback/tests/mod.rs index f7eb9a3..a693819 100644 --- a/src/feedback/tests/mod.rs +++ b/src/feedback/tests/mod.rs @@ -149,9 +149,19 @@ fn the_owner_reads_what_is_shown(cx: &mut TestAppContext) { push(&view, Toast::new("Denied").severity(Severity::Danger), cx); let toaster = view.read_with(cx, |desk, _| desk.toaster.clone()); let shown = |cx: &mut VisualTestContext| toaster.read_with(cx, |toaster, _| toaster.shown()); - assert_eq!(shown(cx), [("Saved".into(), None), ("Denied".into(), Some(Severity::Danger))]); + assert_eq!( + shown(cx), + [ + ("Saved".into(), None), + ("Denied".into(), Some(Severity::Danger)) + ] + ); toaster.update(cx, |toaster, cx| toaster.dismiss(first, cx)); - assert_eq!(shown(cx), [("Denied".into(), Some(Severity::Danger))], "a leaving toast is not shown"); + assert_eq!( + shown(cx), + [("Denied".into(), Some(Severity::Danger))], + "a leaving toast is not shown" + ); } #[gpui::test] diff --git a/src/feedback/toast.rs b/src/feedback/toast.rs index 0e8b103..a9ac99b 100644 --- a/src/feedback/toast.rs +++ b/src/feedback/toast.rs @@ -128,7 +128,9 @@ impl Toaster { /// The titles and severities on show, oldest first. pub fn shown(&self) -> Vec<(SharedString, Option)> { let staying = self.live.iter().filter(|live| !live.leaving); - staying.map(|live| (live.toast.title.clone(), live.toast.severity)).collect() + staying + .map(|live| (live.toast.title.clone(), live.toast.severity)) + .collect() } /// Sends a toast away: it fades and folds, then leaves the stack. diff --git a/src/shell/update.rs b/src/shell/update.rs index 353d1af..705490f 100644 --- a/src/shell/update.rs +++ b/src/shell/update.rs @@ -124,7 +124,11 @@ impl RenderOnce for UpdateBanner { UpdateState::Available => text(cx, "update.available", &[("version", version)]), UpdateState::Downloading(value) => { let percent = (value * 100.0).round().to_string(); - text(cx, "update.downloading", &[("version", version), ("percent", &percent)]) + text( + cx, + "update.downloading", + &[("version", version), ("percent", &percent)], + ) } UpdateState::Ready => text(cx, "update.ready", &[("version", version)]), }; @@ -220,7 +224,10 @@ impl UpdateDialog { impl RenderOnce for UpdateDialog { fn render(self, _: &mut Window, cx: &mut App) -> impl IntoElement { - let args = [("name", self.name.as_ref()), ("version", self.version.as_ref())]; + let args = [ + ("name", self.name.as_ref()), + ("version", self.version.as_ref()), + ]; let headline = match self.state { UpdateState::Ready => text(cx, "update.headline.ready", &args), _ => text(cx, "update.headline.available", &args),