From eb30105fc250fdec2db96ecfd9b99d5ae65cfe61 Mon Sep 17 00:00:00 2001 From: Jake Stanger Date: Sat, 28 Jan 2023 14:40:31 +0000 Subject: [PATCH] style: fix 1.67 clippy warnings --- src/clients/compositor/mod.rs | 12 ++++++------ src/clients/wayland/toplevel_manager.rs | 2 +- src/icon.rs | 3 +-- src/modules/music.rs | 13 ++++++------- src/modules/sysinfo.rs | 7 ++----- src/script.rs | 6 +++--- 6 files changed, 19 insertions(+), 24 deletions(-) diff --git a/src/clients/compositor/mod.rs b/src/clients/compositor/mod.rs index 48a2dc25..faccc788 100644 --- a/src/clients/compositor/mod.rs +++ b/src/clients/compositor/mod.rs @@ -18,9 +18,9 @@ impl Display for Compositor { f, "{}", match self { - Compositor::Sway => "Sway", - Compositor::Hyprland => "Hyprland", - Compositor::Unsupported => "Unsupported", + Self::Sway => "Sway", + Self::Hyprland => "Hyprland", + Self::Unsupported => "Unsupported", } ) } @@ -44,9 +44,9 @@ impl Compositor { let current = Self::get_current(); debug!("Getting workspace client for: {current}"); match current { - Compositor::Sway => Ok(sway::get_sub_client()), - Compositor::Hyprland => Ok(hyprland::get_client()), - Compositor::Unsupported => Err(Report::msg("Unsupported compositor") + Self::Sway => Ok(sway::get_sub_client()), + Self::Hyprland => Ok(hyprland::get_client()), + Self::Unsupported => Err(Report::msg("Unsupported compositor") .note("Currently workspaces are only supported by Sway and Hyprland")), } } diff --git a/src/clients/wayland/toplevel_manager.rs b/src/clients/wayland/toplevel_manager.rs index 8471b576..4eafb17b 100644 --- a/src/clients/wayland/toplevel_manager.rs +++ b/src/clients/wayland/toplevel_manager.rs @@ -58,7 +58,7 @@ impl GlobalHandler for ToplevelHandler { if inner.registry.is_none() { inner.registry = Some(registry); } - if let LazyGlobal::Unknown = inner.manager { + if matches!(inner.manager, LazyGlobal::Unknown) { inner.manager = LazyGlobal::Seen { id, version } } else { warn!( diff --git a/src/icon.rs b/src/icon.rs index 8890dc48..b2c6fd20 100644 --- a/src/icon.rs +++ b/src/icon.rs @@ -101,8 +101,7 @@ fn get_icon_location(theme: &IconTheme, app_id: &str, size: i32) -> Option { let path = dir.join(format!( - "icons/hicolor/32x32/apps/steam_icon_{}.png", - steam_id + "icons/hicolor/32x32/apps/steam_icon_{steam_id}.png" )); return Some(IconLocation::File(path)); diff --git a/src/modules/music.rs b/src/modules/music.rs index dcb300af..447d2f33 100644 --- a/src/modules/music.rs +++ b/src/modules/music.rs @@ -1,5 +1,6 @@ -use crate::clients::music::{self, MusicClient, PlayerState, Status, Track}; +use crate::clients::music::{self, MusicClient, PlayerState, PlayerUpdate, Status, Track}; use crate::config::CommonConfig; +use crate::error::ERR_CHANNEL_SEND; use crate::modules::{Module, ModuleInfo, ModuleUpdateEvent, ModuleWidget, WidgetContext}; use crate::popup::Popup; use crate::try_send; @@ -15,7 +16,6 @@ use std::path::PathBuf; use std::sync::Arc; use std::time::Duration; use tokio::spawn; -use tokio::sync::mpsc; use tokio::sync::mpsc::{Receiver, Sender}; use tracing::error; @@ -122,7 +122,7 @@ fn format_time(duration: Duration) -> String { let minutes = (time / 60) % 60; let seconds = time % 60; - format!("{:0>2}:{:0>2}", minutes, seconds) + format!("{minutes:0>2}:{seconds:0>2}") } /// Extracts the formatting tokens from a formatting string @@ -395,7 +395,7 @@ impl Module