From a4ba7ab145fd363f455883d70ad5548c6f150c0e Mon Sep 17 00:00:00 2001 From: Eduardo Flores Date: Tue, 31 Dec 2024 13:20:16 +0100 Subject: [PATCH] fix: replace dyn with impl for return type --- src/platforms/freedesktop/subscribe.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/platforms/freedesktop/subscribe.rs b/src/platforms/freedesktop/subscribe.rs index 1c8f0a8..55ad218 100644 --- a/src/platforms/freedesktop/subscribe.rs +++ b/src/platforms/freedesktop/subscribe.rs @@ -1,5 +1,4 @@ use std::error::Error; -use std::pin::Pin; use ashpd::desktop::settings::Settings; use futures::{stream, Stream, StreamExt}; @@ -33,18 +32,17 @@ pub fn subscribe() -> std::sync::mpsc::Receiver { } #[cfg(not(feature = "sync"))] -pub async fn subscribe() -> Pin + Send>> { +pub async fn subscribe() -> impl Stream + Send { match color_scheme_stream().await { Ok(stream) => stream, Err(err) => { log::error!("Failed to subscribe to color scheme changes: {}", err); - Box::pin(Box::new(stream::empty())) + panic!("Failed to subscribe to color scheme changes: {}", err); } } } -pub async fn color_scheme_stream( -) -> Result + Send>>, Box> { +pub async fn color_scheme_stream() -> Result + Send, Box> { let initial = stream::once(super::get_color_scheme()).boxed(); let later_updates = Settings::new() .await? @@ -52,5 +50,5 @@ pub async fn color_scheme_stream( .await? .map(Mode::from) .boxed(); - Ok(Box::pin(Box::new(initial.chain(later_updates)))) + Ok(Box::pin(initial.chain(later_updates))) }