diff --git a/crates/copilot/src/copilot.rs b/crates/copilot/src/copilot.rs index 93ab35533878fda20acc5a12761b89ddf90c0150..d3a47c6068e613145c6a36a6e75883e56e7a86b9 100644 --- a/crates/copilot/src/copilot.rs +++ b/crates/copilot/src/copilot.rs @@ -37,7 +37,7 @@ const COPILOT_NAMESPACE: &'static str = "copilot"; actions!(copilot, [NextSuggestion, PreviousSuggestion, Reinstall]); pub fn init(client: Arc, node_runtime: Arc, cx: &mut MutableAppContext) { - staff_mode::(cx, { + staff_mode(cx, { move |cx| { cx.update_global::(|filter, _cx| { filter.filtered_namespaces.remove(COPILOT_NAMESPACE); @@ -56,7 +56,7 @@ pub fn init(client: Arc, node_runtime: Arc, cx: &mut Mutabl sign_in::init(cx); } }); - not_staff_mode::(cx, |cx| { + not_staff_mode(cx, |cx| { cx.update_global::(|filter, _cx| { filter.filtered_namespaces.insert(COPILOT_NAMESPACE); filter.filtered_namespaces.insert(COPILOT_AUTH_NAMESPACE); diff --git a/crates/staff_mode/src/staff_mode.rs b/crates/staff_mode/src/staff_mode.rs index bf5c0e9caf289ec8ccc633cbf0e1bf5f5d568250..4d35a257ed60744b4b9a2559e2f072d3cf6b72f5 100644 --- a/crates/staff_mode/src/staff_mode.rs +++ b/crates/staff_mode/src/staff_mode.rs @@ -13,11 +13,11 @@ impl std::ops::Deref for StaffMode { /// Despite what the type system requires me to tell you, the init function will only be called a once /// as soon as we know that the staff mode is enabled. -pub fn staff_mode( +pub fn staff_mode( cx: &mut MutableAppContext, mut init: F, ) { - if !S::staff_only() || **cx.default_global::() { + if **cx.default_global::() { init(cx) } else { let mut once = Some(()); @@ -31,21 +31,11 @@ pub fn staff_mode( +pub fn not_staff_mode( cx: &mut MutableAppContext, init: F, ) { - if !S::staff_only() || !**cx.default_global::() { + if !**cx.default_global::() { init(cx) } } - -pub trait StaffModeConfiguration { - fn staff_only() -> bool { - true - } -} - -pub enum Copilot {} - -impl StaffModeConfiguration for Copilot {}