Put context parameter last in toggle_modal callback

Nathan Sobo created

This is more consistent with our treatment of context params everywhere else.

Change summary

crates/command_palette/src/command_palette.rs | 2 +-
crates/contacts_panel/src/contact_finder.rs   | 2 +-
crates/file_finder/src/file_finder.rs         | 2 +-
crates/go_to_line/src/go_to_line.rs           | 2 +-
crates/outline/src/outline.rs                 | 2 +-
crates/project_symbols/src/project_symbols.rs | 2 +-
crates/theme_selector/src/theme_selector.rs   | 2 +-
crates/workspace/src/workspace.rs             | 4 ++--
8 files changed, 9 insertions(+), 9 deletions(-)

Detailed changes

crates/command_palette/src/command_palette.rs 🔗

@@ -71,7 +71,7 @@ impl CommandPalette {
         cx.as_mut().defer(move |cx| {
             let this = cx.add_view(window_id, |cx| Self::new(focused_view_id, cx));
             workspace.update(cx, |workspace, cx| {
-                workspace.toggle_modal(cx, |cx, _| {
+                workspace.toggle_modal(cx, |_, cx| {
                     cx.subscribe(&this, Self::on_event).detach();
                     this
                 });

crates/contacts_panel/src/contact_finder.rs 🔗

@@ -159,7 +159,7 @@ impl PickerDelegate for ContactFinder {
 
 impl ContactFinder {
     fn toggle(workspace: &mut Workspace, _: &Toggle, cx: &mut ViewContext<Workspace>) {
-        workspace.toggle_modal(cx, |cx, workspace| {
+        workspace.toggle_modal(cx, |workspace, cx| {
             let finder = cx.add_view(|cx| Self::new(workspace.user_store().clone(), cx));
             cx.subscribe(&finder, Self::on_event).detach();
             finder

crates/file_finder/src/file_finder.rs 🔗

@@ -85,7 +85,7 @@ impl FileFinder {
     }
 
     fn toggle(workspace: &mut Workspace, _: &Toggle, cx: &mut ViewContext<Workspace>) {
-        workspace.toggle_modal(cx, |cx, workspace| {
+        workspace.toggle_modal(cx, |workspace, cx| {
             let project = workspace.project().clone();
             let finder = cx.add_view(|cx| Self::new(project, cx));
             cx.subscribe(&finder, Self::on_event).detach();

crates/go_to_line/src/go_to_line.rs 🔗

@@ -62,7 +62,7 @@ impl GoToLine {
             .active_item(cx)
             .and_then(|active_item| active_item.downcast::<Editor>())
         {
-            workspace.toggle_modal(cx, |cx, _| {
+            workspace.toggle_modal(cx, |_, cx| {
                 let view = cx.add_view(|cx| GoToLine::new(editor, cx));
                 cx.subscribe(&view, Self::on_event).detach();
                 view

crates/outline/src/outline.rs 🔗

@@ -87,7 +87,7 @@ impl OutlineView {
                 .read(cx)
                 .outline(Some(cx.global::<Settings>().theme.editor.syntax.as_ref()));
             if let Some(outline) = buffer {
-                workspace.toggle_modal(cx, |cx, _| {
+                workspace.toggle_modal(cx, |_, cx| {
                     let view = cx.add_view(|cx| OutlineView::new(outline, editor, cx));
                     cx.subscribe(&view, Self::on_event).detach();
                     view

crates/project_symbols/src/project_symbols.rs 🔗

@@ -71,7 +71,7 @@ impl ProjectSymbolsView {
     }
 
     fn toggle(workspace: &mut Workspace, _: &Toggle, cx: &mut ViewContext<Workspace>) {
-        workspace.toggle_modal(cx, |cx, workspace| {
+        workspace.toggle_modal(cx, |workspace, cx| {
             let project = workspace.project().clone();
             let symbols = cx.add_view(|cx| Self::new(project, cx));
             cx.subscribe(&symbols, Self::on_event).detach();

crates/theme_selector/src/theme_selector.rs 🔗

@@ -66,7 +66,7 @@ impl ThemeSelector {
 
     fn toggle(workspace: &mut Workspace, _: &Toggle, cx: &mut ViewContext<Workspace>) {
         let themes = workspace.themes();
-        workspace.toggle_modal(cx, |cx, _| {
+        workspace.toggle_modal(cx, |_, cx| {
             let this = cx.add_view(|cx| Self::new(themes, cx));
             cx.subscribe(&this, Self::on_event).detach();
             this

crates/workspace/src/workspace.rs 🔗

@@ -943,7 +943,7 @@ impl Workspace {
     ) -> Option<ViewHandle<V>>
     where
         V: 'static + View,
-        F: FnOnce(&mut ViewContext<Self>, &mut Self) -> ViewHandle<V>,
+        F: FnOnce(&mut Self, &mut ViewContext<Self>) -> ViewHandle<V>,
     {
         cx.notify();
         // Whatever modal was visible is getting clobbered. If its the same type as V, then return
@@ -953,7 +953,7 @@ impl Workspace {
             cx.focus_self();
             Some(already_open_modal)
         } else {
-            let modal = add_view(cx, self);
+            let modal = add_view(self, cx);
             cx.focus(&modal);
             self.modal = Some(modal.into());
             None