From 0122cd61c555154c61f9f94c0c23f671c322bdf5 Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Tue, 30 May 2023 16:33:42 -0700 Subject: [PATCH] fmt --- crates/terminal_view/src/terminal_panel.rs | 11 ++++++----- crates/terminal_view/src/terminal_view.rs | 2 +- crates/workspace/src/dock.rs | 3 ++- crates/workspace/src/pane.rs | 4 ++-- crates/workspace/src/workspace.rs | 14 +++++++++++--- crates/zed/src/menus.rs | 15 +++------------ 6 files changed, 25 insertions(+), 24 deletions(-) diff --git a/crates/terminal_view/src/terminal_panel.rs b/crates/terminal_view/src/terminal_panel.rs index c2f7eb36e4..e45459e683 100644 --- a/crates/terminal_view/src/terminal_panel.rs +++ b/crates/terminal_view/src/terminal_panel.rs @@ -220,15 +220,16 @@ impl TerminalPanel { } } - - fn new_terminal(workspace: &mut Workspace, _: &workspace::NewTerminal, cx: &mut ViewContext) { + fn new_terminal( + workspace: &mut Workspace, + _: &workspace::NewTerminal, + cx: &mut ViewContext, + ) { let Some(this) = workspace.focus_panel::(cx) else { return; }; - this.update(cx, |this, cx| { - this.add_terminal(cx) - }) + this.update(cx, |this, cx| this.add_terminal(cx)) } fn add_terminal(&mut self, cx: &mut ViewContext) { diff --git a/crates/terminal_view/src/terminal_view.rs b/crates/terminal_view/src/terminal_view.rs index 633b83afb8..7f43f99ebd 100644 --- a/crates/terminal_view/src/terminal_view.rs +++ b/crates/terminal_view/src/terminal_view.rs @@ -38,7 +38,7 @@ use workspace::{ notifications::NotifyResultExt, pane, register_deserializable_item, searchable::{SearchEvent, SearchOptions, SearchableItem, SearchableItemHandle}, - Pane, ToolbarItemLocation, Workspace, WorkspaceId, NewCenterTerminal, + NewCenterTerminal, Pane, ToolbarItemLocation, Workspace, WorkspaceId, }; pub use terminal::TerminalSettings; diff --git a/crates/workspace/src/dock.rs b/crates/workspace/src/dock.rs index 2f198f62f4..886afe943d 100644 --- a/crates/workspace/src/dock.rs +++ b/crates/workspace/src/dock.rs @@ -517,7 +517,8 @@ impl View for PanelButtons { &*tooltip_action, ) .ok(); - }).detach(); + }) + .detach(); } } }) diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index 8dca08ec81..921ae5e010 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -2,8 +2,8 @@ mod dragged_item_receiver; use super::{ItemHandle, SplitDirection}; use crate::{ - item::WeakItemHandle, toolbar::Toolbar, AutosaveSetting, Item, NewFile, NewSearch, - ToggleZoom, Workspace, WorkspaceSettings, NewCenterTerminal, + item::WeakItemHandle, toolbar::Toolbar, AutosaveSetting, Item, NewCenterTerminal, NewFile, + NewSearch, ToggleZoom, Workspace, WorkspaceSettings, }; use anyhow::Result; use collections::{HashMap, HashSet, VecDeque}; diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index 0aefe455ac..d051f6d80a 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -53,9 +53,10 @@ use std::{ cmp, env, future::Future, path::{Path, PathBuf}, + rc::Rc, str, sync::{atomic::AtomicUsize, Arc}, - time::Duration, rc::Rc, + time::Duration, }; use crate::{ @@ -1623,14 +1624,21 @@ impl Workspace { } pub fn focus_panel(&mut self, cx: &mut ViewContext) -> Option> { - self.show_or_hide_panel::(cx, |_, _| true)?.as_any().clone().downcast() + self.show_or_hide_panel::(cx, |_, _| true)? + .as_any() + .clone() + .downcast() } pub fn toggle_panel_focus(&mut self, cx: &mut ViewContext) { self.show_or_hide_panel::(cx, |panel, cx| !panel.has_focus(cx)); } - fn show_or_hide_panel(&mut self, cx: &mut ViewContext, show: impl Fn(&dyn PanelHandle, &mut ViewContext) -> bool) -> Option> { + fn show_or_hide_panel( + &mut self, + cx: &mut ViewContext, + show: impl Fn(&dyn PanelHandle, &mut ViewContext) -> bool, + ) -> Option> { for (dock, position) in [ self.left_dock.clone(), self.bottom_dock.clone(), diff --git a/crates/zed/src/menus.rs b/crates/zed/src/menus.rs index ecfd567e78..76e88325f5 100644 --- a/crates/zed/src/menus.rs +++ b/crates/zed/src/menus.rs @@ -89,18 +89,9 @@ pub fn menus() -> Vec> { MenuItem::action("Zoom Out", super::DecreaseBufferFontSize), MenuItem::action("Reset Zoom", super::ResetBufferFontSize), MenuItem::separator(), - MenuItem::action( - "Toggle Left Dock", - workspace::ToggleLeftDock, - ), - MenuItem::action( - "Toggle Right Dock", - workspace::ToggleRightDock, - ), - MenuItem::action( - "Toggle Bottom Dock", - workspace::ToggleBottomDock, - ), + MenuItem::action("Toggle Left Dock", workspace::ToggleLeftDock), + MenuItem::action("Toggle Right Dock", workspace::ToggleRightDock), + MenuItem::action("Toggle Bottom Dock", workspace::ToggleBottomDock), MenuItem::submenu(Menu { name: "Editor Layout", items: vec![