diff --git a/src/dynamic_value/dynamic_bool.rs b/src/dynamic_value/dynamic_bool.rs index 711a92a..31e149a 100644 --- a/src/dynamic_value/dynamic_bool.rs +++ b/src/dynamic_value/dynamic_bool.rs @@ -39,7 +39,7 @@ impl DynamicBool { _ => self, }; - let (tx, mut rx) = mpsc::channel(32); + let (tx, rx) = mpsc::channel(32); glib_recv_mpsc!(rx, val => f(val)); diff --git a/src/dynamic_value/dynamic_string.rs b/src/dynamic_value/dynamic_string.rs index 7654f97..ea2eb39 100644 --- a/src/dynamic_value/dynamic_string.rs +++ b/src/dynamic_value/dynamic_string.rs @@ -32,7 +32,7 @@ where let tokens = parse_input(input); let label_parts = arc_mut!(vec![]); - let (tx, mut rx) = mpsc::channel(32); + let (tx, rx) = mpsc::channel(32); for (i, segment) in tokens.into_iter().enumerate() { match segment { diff --git a/src/image/provider.rs b/src/image/provider.rs index defefb6..a23debf 100644 --- a/src/image/provider.rs +++ b/src/image/provider.rs @@ -145,7 +145,7 @@ impl<'a> ImageProvider<'a> { #[cfg(feature = "http")] if let ImageLocation::Remote(url) = &self.location { let url = url.clone(); - let (tx, mut rx) = mpsc::channel(64); + let (tx, rx) = mpsc::channel(64); spawn(async move { let bytes = Self::get_bytes_from_http(url).await; diff --git a/src/ipc/server.rs b/src/ipc/server.rs index 26c76b3..9bf7379 100644 --- a/src/ipc/server.rs +++ b/src/ipc/server.rs @@ -22,7 +22,7 @@ impl Ipc { /// /// Once started, the server will begin accepting connections. pub fn start(&self, application: &Application, ironbar: Rc) { - let (cmd_tx, mut cmd_rx) = mpsc::channel(32); + let (cmd_tx, cmd_rx) = mpsc::channel(32); let (res_tx, mut res_rx) = mpsc::channel(32); let path = self.path.clone(); diff --git a/src/macros.rs b/src/macros.rs index deb8975..e71a593 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -58,13 +58,15 @@ macro_rules! try_send { /// ``` #[macro_export] macro_rules! glib_recv { - ($rx:expr, $val:ident => $expr:expr) => { + ($rx:expr, $val:ident => $expr:expr) => {{ glib::spawn_future_local(async move { - while let Ok($val) = $rx.recv().await { + // re-delcare in case ie `context.subscribe()` is passed directly + let mut rx = $rx; + while let Ok($val) = rx.recv().await { $expr } }); - }; + }}; } /// Spawns a `GLib` future on the local thread, and calls `rx.recv()` @@ -83,13 +85,15 @@ macro_rules! glib_recv { /// ``` #[macro_export] macro_rules! glib_recv_mpsc { - ($rx:expr, $val:ident => $expr:expr) => { + ($rx:expr, $val:ident => $expr:expr) => {{ glib::spawn_future_local(async move { - while let Some($val) = $rx.recv().await { + // re-delcare in case ie `context.subscribe()` is passed directly + let mut rx = $rx; + while let Some($val) = rx.recv().await { $expr } }); - }; + }}; } /// Locks a `Mutex`. diff --git a/src/modules/clipboard.rs b/src/modules/clipboard.rs index cdc72fb..c7ef2bf 100644 --- a/src/modules/clipboard.rs +++ b/src/modules/clipboard.rs @@ -145,7 +145,7 @@ impl Module