Merge MutableAppContext into AppContext

There may have been a good reason for the difference at some point, or I was
still learning Rust. But now it's just &mut AppContext vs &AppContext.
This commit is contained in:
Nathan Sobo
2023-04-06 15:49:03 -06:00
parent dd00966cc6
commit de9bf6dfbd
112 changed files with 882 additions and 1041 deletions
+5 -5
View File
@@ -1,4 +1,4 @@
use gpui::MutableAppContext;
use gpui::AppContext;
#[derive(Debug, Default)]
pub struct StaffMode(pub bool);
@@ -13,8 +13,8 @@ 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<F: FnMut(&mut MutableAppContext) + 'static>(
cx: &mut MutableAppContext,
pub fn staff_mode<F: FnMut(&mut AppContext) + 'static>(
cx: &mut AppContext,
mut init: F,
) {
if **cx.default_global::<StaffMode>() {
@@ -32,8 +32,8 @@ pub fn staff_mode<F: FnMut(&mut MutableAppContext) + 'static>(
/// Immediately checks and runs the init function if the staff mode is not enabled.
/// This is only included for symettry with staff_mode() above
pub fn not_staff_mode<F: FnOnce(&mut MutableAppContext) + 'static>(
cx: &mut MutableAppContext,
pub fn not_staff_mode<F: FnOnce(&mut AppContext) + 'static>(
cx: &mut AppContext,
init: F,
) {
if !**cx.default_global::<StaffMode>() {