From 9c68c3e8a9f5bb0c61dbf58d14f91556b9851800 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 10 May 2022 16:46:53 -0600 Subject: [PATCH] Put context parameter last in toggle_modal callback This is more consistent with our treatment of context params everywhere else. --- 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(-) diff --git a/crates/command_palette/src/command_palette.rs b/crates/command_palette/src/command_palette.rs index b6058c01e5..f724cc19a6 100644 --- a/crates/command_palette/src/command_palette.rs +++ b/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 }); diff --git a/crates/contacts_panel/src/contact_finder.rs b/crates/contacts_panel/src/contact_finder.rs index 5a480911d4..3b88eaf117 100644 --- a/crates/contacts_panel/src/contact_finder.rs +++ b/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.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 diff --git a/crates/file_finder/src/file_finder.rs b/crates/file_finder/src/file_finder.rs index a63ff7b0bd..e85147d7e2 100644 --- a/crates/file_finder/src/file_finder.rs +++ b/crates/file_finder/src/file_finder.rs @@ -85,7 +85,7 @@ impl FileFinder { } fn toggle(workspace: &mut Workspace, _: &Toggle, cx: &mut ViewContext) { - 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(); diff --git a/crates/go_to_line/src/go_to_line.rs b/crates/go_to_line/src/go_to_line.rs index 3f8aa933ba..9e2c79c5dc 100644 --- a/crates/go_to_line/src/go_to_line.rs +++ b/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::()) { - 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 diff --git a/crates/outline/src/outline.rs b/crates/outline/src/outline.rs index 5658cf2011..f5057ba39d 100644 --- a/crates/outline/src/outline.rs +++ b/crates/outline/src/outline.rs @@ -87,7 +87,7 @@ impl OutlineView { .read(cx) .outline(Some(cx.global::().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 diff --git a/crates/project_symbols/src/project_symbols.rs b/crates/project_symbols/src/project_symbols.rs index 157ea8ef73..5322a8924a 100644 --- a/crates/project_symbols/src/project_symbols.rs +++ b/crates/project_symbols/src/project_symbols.rs @@ -71,7 +71,7 @@ impl ProjectSymbolsView { } fn toggle(workspace: &mut Workspace, _: &Toggle, cx: &mut ViewContext) { - 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(); diff --git a/crates/theme_selector/src/theme_selector.rs b/crates/theme_selector/src/theme_selector.rs index 1904ed89d9..718268788c 100644 --- a/crates/theme_selector/src/theme_selector.rs +++ b/crates/theme_selector/src/theme_selector.rs @@ -66,7 +66,7 @@ impl ThemeSelector { fn toggle(workspace: &mut Workspace, _: &Toggle, cx: &mut ViewContext) { 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 diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index d5b0bf2ed5..688accfcb9 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -943,7 +943,7 @@ impl Workspace { ) -> Option> where V: 'static + View, - F: FnOnce(&mut ViewContext, &mut Self) -> ViewHandle, + F: FnOnce(&mut Self, &mut ViewContext) -> ViewHandle, { 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