From d17894f94eec08ec3cfc9d39cf1d945e23a0a91c Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Mon, 12 Feb 2024 11:40:20 -0500 Subject: [PATCH] chore: clippy --- cosmic-applet-audio/src/main.rs | 2 +- cosmic-applet-audio/src/mpris_subscription.rs | 6 +++--- cosmic-applet-notifications/src/main.rs | 2 +- cosmic-applet-status-area/src/components/app.rs | 2 +- cosmic-applet-tiling/src/wayland_subscription.rs | 8 -------- cosmic-applet-tiling/src/window.rs | 12 ++++++------ cosmic-applet-workspaces/src/wayland_subscription.rs | 8 -------- 7 files changed, 12 insertions(+), 28 deletions(-) diff --git a/cosmic-applet-audio/src/main.rs b/cosmic-applet-audio/src/main.rs index a91d4257..68b3ad70 100644 --- a/cosmic-applet-audio/src/main.rs +++ b/cosmic-applet-audio/src/main.rs @@ -561,7 +561,7 @@ impl cosmic::Application for Audio { self.timeline .as_subscription() .map(|(_, now)| Message::Frame(now)), - self.core.watch_config(Self::APP_ID.into()).map(|u| { + self.core.watch_config(Self::APP_ID).map(|u| { for err in u.errors { tracing::error!(?err, "Error watching config"); } diff --git a/cosmic-applet-audio/src/mpris_subscription.rs b/cosmic-applet-audio/src/mpris_subscription.rs index 08205e26..1cba9e9e 100644 --- a/cosmic-applet-audio/src/mpris_subscription.rs +++ b/cosmic-applet-audio/src/mpris_subscription.rs @@ -165,7 +165,7 @@ async fn update(state: State, output: &mut futures::channel::mpsc::Sender) -> Option { players.sort_by(|a, b| { let a = a.destination(); let b = b.destination(); - a.cmp(&b) + a.cmp(b) }); let mut best = (0, None); let eval = |p: Player| async move { diff --git a/cosmic-applet-notifications/src/main.rs b/cosmic-applet-notifications/src/main.rs index 8b7e709e..3b2d4108 100644 --- a/cosmic-applet-notifications/src/main.rs +++ b/cosmic-applet-notifications/src/main.rs @@ -161,7 +161,7 @@ impl cosmic::Application for Notifications { fn subscription(&self) -> Subscription { Subscription::batch(vec![ self.core - .watch_config(cosmic_notifications_config::ID.into()) + .watch_config(cosmic_notifications_config::ID) .map(|res| { for err in res.errors { tracing::error!("{:?}", err); diff --git a/cosmic-applet-status-area/src/components/app.rs b/cosmic-applet-status-area/src/components/app.rs index bf11379d..39a70b76 100644 --- a/cosmic-applet-status-area/src/components/app.rs +++ b/cosmic-applet-status-area/src/components/app.rs @@ -8,7 +8,7 @@ use cosmic::{ }, window, Subscription, }, - iced_style::{application, menu}, + iced_style::{application}, Theme, }; use std::collections::BTreeMap; diff --git a/cosmic-applet-tiling/src/wayland_subscription.rs b/cosmic-applet-tiling/src/wayland_subscription.rs index e16e50d3..31ec4fc4 100644 --- a/cosmic-applet-tiling/src/wayland_subscription.rs +++ b/cosmic-applet-tiling/src/wayland_subscription.rs @@ -80,12 +80,4 @@ impl WorkspacesWatcher { let tx = wayland::spawn_workspaces(tx); Ok(Self { tx, rx }) } - - pub fn get_sender(&self) -> SyncSender { - self.tx.clone() - } - - pub async fn workspaces(&mut self) -> Option { - self.rx.next().await - } } diff --git a/cosmic-applet-tiling/src/window.rs b/cosmic-applet-tiling/src/window.rs index 96797425..c6f28690 100644 --- a/cosmic-applet-tiling/src/window.rs +++ b/cosmic-applet-tiling/src/window.rs @@ -50,7 +50,7 @@ pub enum Message { Frame(Instant), ToggleTileWindows(chain::Toggler, bool), ToggleActiveHint(chain::Toggler, bool), - MyConfigUpdate(CosmicCompConfig), + MyConfigUpdate(Box), TileMode(Entity), WorkspaceUpdate(WorkspacesUpdate), NewWorkspace(Entity), @@ -144,8 +144,8 @@ impl cosmic::Application for Window { timeline, self.core .watch_config::("com.system76.CosmicComp") - .map(|u| Message::MyConfigUpdate(u.config)), - wayland_subscription::workspaces().map(|e| Message::WorkspaceUpdate(e)), + .map(|u| Message::MyConfigUpdate(Box::new(u.config))), + wayland_subscription::workspaces().map(Message::WorkspaceUpdate), ]) } @@ -258,7 +258,7 @@ impl cosmic::Application for Window { }); } - self.config = c; + self.config = *c; } Message::TileMode(e) => { let behavior = if e == self.autotile_global_entity { @@ -311,7 +311,7 @@ impl cosmic::Application for Window { segmented_selection::horizontal(&self.new_workspace_behavior_model); if matches!(self.config.autotile_behavior, TileBehavior::PerWorkspace) { new_workspace_behavior_button = - new_workspace_behavior_button.on_activate(|e| Message::NewWorkspace(e)); + new_workspace_behavior_button.on_activate(Message::NewWorkspace); } let content_list = column![ padded_control(container( @@ -336,7 +336,7 @@ impl cosmic::Application for Window { column![ text(fl!("autotile-behavior")).size(14), segmented_selection::horizontal(&self.autotile_behavior_model) - .on_activate(|e| Message::TileMode(e)) + .on_activate(Message::TileMode) ], divider::horizontal::default(), column![ diff --git a/cosmic-applet-workspaces/src/wayland_subscription.rs b/cosmic-applet-workspaces/src/wayland_subscription.rs index d3d91db4..4b583f3d 100644 --- a/cosmic-applet-workspaces/src/wayland_subscription.rs +++ b/cosmic-applet-workspaces/src/wayland_subscription.rs @@ -79,12 +79,4 @@ impl WorkspacesWatcher { let tx = wayland::spawn_workspaces(tx); Ok(Self { tx, rx }) } - - pub fn get_sender(&self) -> SyncSender { - self.tx.clone() - } - - pub async fn workspaces(&mut self) -> Option { - self.rx.next().await - } }