diff --git a/komorebi-bar/src/bar.rs b/komorebi-bar/src/bar.rs index bdb74e1f..05172085 100644 --- a/komorebi-bar/src/bar.rs +++ b/komorebi-bar/src/bar.rs @@ -128,7 +128,7 @@ fn stop_powershell() -> Result<()> { pub fn exec_powershell(cmd: &str) -> Result<()> { if let Some(session_stdin) = SESSION_STDIN.lock().as_mut() { - if let Err(e) = writeln!(session_stdin, "{}", cmd) { + if let Err(e) = writeln!(session_stdin, "{cmd}") { tracing::error!(error = %e, cmd = cmd, "failed to write command to PowerShell stdin"); return Err(e); } @@ -635,8 +635,7 @@ impl Komobar { assert!( home.is_dir(), - "$Env:KOMOREBI_CONFIG_HOME is set to '{}', which is not a valid directory", - home_path + "$Env:KOMOREBI_CONFIG_HOME is set to '{home_path}', which is not a valid directory" ); home diff --git a/komorebi-bar/src/main.rs b/komorebi-bar/src/main.rs index 3f06b6c0..7bb5c1b6 100644 --- a/komorebi-bar/src/main.rs +++ b/komorebi-bar/src/main.rs @@ -159,8 +159,7 @@ fn main() -> color_eyre::Result<()> { assert!( home.is_dir(), - "$Env:KOMOREBI_CONFIG_HOME is set to '{}', which is not a valid directory", - home_path + "$Env:KOMOREBI_CONFIG_HOME is set to '{home_path}', which is not a valid directory" ); home diff --git a/komorebi-bar/src/widgets/battery.rs b/komorebi-bar/src/widgets/battery.rs index 94976ca1..3ce3f9e2 100644 --- a/komorebi-bar/src/widgets/battery.rs +++ b/komorebi-bar/src/widgets/battery.rs @@ -181,7 +181,7 @@ impl BarWidget for Battery { .args(["/C", "start", "ms-settings:batterysaver"]) .spawn() { - eprintln!("{}", error) + eprintln!("{error}") } } }); diff --git a/komorebi-bar/src/widgets/cpu.rs b/komorebi-bar/src/widgets/cpu.rs index c7bca328..2770a739 100644 --- a/komorebi-bar/src/widgets/cpu.rs +++ b/komorebi-bar/src/widgets/cpu.rs @@ -76,8 +76,8 @@ impl Cpu { CpuOutput { label: match self.label_prefix { - LabelPrefix::Text | LabelPrefix::IconAndText => format!("CPU: {}%", used), - LabelPrefix::None | LabelPrefix::Icon => format!("{}%", used), + LabelPrefix::Text | LabelPrefix::IconAndText => format!("CPU: {used}%"), + LabelPrefix::None | LabelPrefix::Icon => format!("{used}%"), }, selected, } @@ -124,7 +124,7 @@ impl BarWidget for Cpu { if let Err(error) = Command::new("cmd.exe").args(["/C", "taskmgr.exe"]).spawn() { - eprintln!("{}", error) + eprintln!("{error}") } } }); diff --git a/komorebi-bar/src/widgets/date.rs b/komorebi-bar/src/widgets/date.rs index aaf4435e..eb806fb8 100644 --- a/komorebi-bar/src/widgets/date.rs +++ b/komorebi-bar/src/widgets/date.rs @@ -166,7 +166,7 @@ impl Date { .to_string() .trim() .to_string(), - Err(_) => format!("Invalid timezone: {}", timezone), + Err(_) => format!("Invalid timezone: {timezone}"), }, None => Local::now() .format(&self.format.fmt_string()) diff --git a/komorebi-bar/src/widgets/komorebi_layout.rs b/komorebi-bar/src/widgets/komorebi_layout.rs index 906767ba..537ed850 100644 --- a/komorebi-bar/src/widgets/komorebi_layout.rs +++ b/komorebi-bar/src/widgets/komorebi_layout.rs @@ -41,8 +41,7 @@ impl<'de> Deserialize<'de> for KomorebiLayout { let s: String = String::deserialize(deserializer)?; // Attempt to deserialize the string as a DefaultLayout - if let Ok(default_layout) = - from_str::(&format!("\"{}\"", s)) + if let Ok(default_layout) = from_str::(&format!("\"{s}\"")) { return Ok(KomorebiLayout::Default(default_layout)); } @@ -53,7 +52,7 @@ impl<'de> Deserialize<'de> for KomorebiLayout { "Floating" => Ok(KomorebiLayout::Floating), "Paused" => Ok(KomorebiLayout::Paused), "Custom" => Ok(KomorebiLayout::Custom), - _ => Err(Error::custom(format!("Invalid layout: {}", s))), + _ => Err(Error::custom(format!("Invalid layout: {s}"))), } } } diff --git a/komorebi-bar/src/widgets/memory.rs b/komorebi-bar/src/widgets/memory.rs index 62d42132..c3281489 100644 --- a/komorebi-bar/src/widgets/memory.rs +++ b/komorebi-bar/src/widgets/memory.rs @@ -79,9 +79,9 @@ impl Memory { MemoryOutput { label: match self.label_prefix { LabelPrefix::Text | LabelPrefix::IconAndText => { - format!("RAM: {}%", usage) + format!("RAM: {usage}%") } - LabelPrefix::None | LabelPrefix::Icon => format!("{}%", usage), + LabelPrefix::None | LabelPrefix::Icon => format!("{usage}%"), }, selected, } @@ -128,7 +128,7 @@ impl BarWidget for Memory { if let Err(error) = Command::new("cmd.exe").args(["/C", "taskmgr.exe"]).spawn() { - eprintln!("{}", error) + eprintln!("{error}") } } }); diff --git a/komorebi-bar/src/widgets/network.rs b/komorebi-bar/src/widgets/network.rs index 6f98c64e..14e01622 100644 --- a/komorebi-bar/src/widgets/network.rs +++ b/komorebi-bar/src/widgets/network.rs @@ -314,7 +314,7 @@ impl Network { .clicked() { if let Err(error) = Command::new("cmd.exe").args(["/C", "ncpa"]).spawn() { - eprintln!("{}", error); + eprintln!("{error}"); } } } @@ -535,6 +535,6 @@ enum DataUnit { impl fmt::Display for DataUnit { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{:?}", self) + write!(f, "{self:?}") } } diff --git a/komorebi-bar/src/widgets/storage.rs b/komorebi-bar/src/widgets/storage.rs index fbeb7730..a04b7a61 100644 --- a/komorebi-bar/src/widgets/storage.rs +++ b/komorebi-bar/src/widgets/storage.rs @@ -87,7 +87,7 @@ impl Storage { LabelPrefix::Text | LabelPrefix::IconAndText => { format!("{} {}%", mount.to_string_lossy(), percentage) } - LabelPrefix::None | LabelPrefix::Icon => format!("{}%", percentage), + LabelPrefix::None | LabelPrefix::Icon => format!("{percentage}%"), }, selected, }) @@ -151,7 +151,7 @@ impl BarWidget for Storage { ]) .spawn() { - eprintln!("{}", error) + eprintln!("{error}") } } }); diff --git a/komorebi-bar/src/widgets/time.rs b/komorebi-bar/src/widgets/time.rs index aed8f093..1dddba54 100644 --- a/komorebi-bar/src/widgets/time.rs +++ b/komorebi-bar/src/widgets/time.rs @@ -209,7 +209,7 @@ impl Time { Some(dt.time()), ) } - Err(_) => (format!("Invalid timezone: {:?}", timezone), None), + Err(_) => (format!("Invalid timezone: {timezone:?}"), None), }, None => { let dt = Local::now(); diff --git a/komorebi-bar/src/widgets/update.rs b/komorebi-bar/src/widgets/update.rs index 4d02573c..5bddc899 100644 --- a/komorebi-bar/src/widgets/update.rs +++ b/komorebi-bar/src/widgets/update.rs @@ -148,7 +148,7 @@ impl BarWidget for Update { )]) .spawn() { - eprintln!("{}", error) + eprintln!("{error}") } } }); diff --git a/komorebi/src/animation/prefix.rs b/komorebi/src/animation/prefix.rs index 26a65ce2..6e91d176 100644 --- a/komorebi/src/animation/prefix.rs +++ b/komorebi/src/animation/prefix.rs @@ -17,5 +17,5 @@ pub enum AnimationPrefix { } pub fn new_animation_key(prefix: AnimationPrefix, key: String) -> String { - format!("{}:{}", prefix, key) + format!("{prefix}:{key}") } diff --git a/komorebi/src/container.rs b/komorebi/src/container.rs index f74f525e..520dc767 100644 --- a/komorebi/src/container.rs +++ b/komorebi/src/container.rs @@ -302,7 +302,7 @@ mod tests { let deserialized: Container = serde_json::from_str(&serialized).expect("Should deserialize"); - assert_eq!(deserialized.locked(), true); + assert!(deserialized.locked()); assert_eq!(deserialized.id(), container.id()); } } diff --git a/komorebi/src/lib.rs b/komorebi/src/lib.rs index ebcf5769..503180f0 100644 --- a/komorebi/src/lib.rs +++ b/komorebi/src/lib.rs @@ -200,8 +200,7 @@ lazy_static! { assert!( home.is_dir(), - "$Env:KOMOREBI_CONFIG_HOME is set to '{}', which is not a valid directory", - home_path + "$Env:KOMOREBI_CONFIG_HOME is set to '{home_path}', which is not a valid directory" ); diff --git a/komorebi/src/lockable_sequence.rs b/komorebi/src/lockable_sequence.rs index 4564895d..b895d697 100644 --- a/komorebi/src/lockable_sequence.rs +++ b/komorebi/src/lockable_sequence.rs @@ -331,12 +331,12 @@ mod tests { let mut ring = test_deque(&[(0, false), (1, true), (2, false), (3, false)]); ring.swap_respecting_locks(0, 1); assert_eq!(vals(&ring), vec![1, 0, 2, 3]); - assert_eq!(ring[0].locked, false); - assert_eq!(ring[1].locked, true); + assert!(!ring[0].locked); + assert!(ring[1].locked); ring.swap_respecting_locks(0, 1); assert_eq!(vals(&ring), vec![0, 1, 2, 3]); - assert_eq!(ring[0].locked, false); - assert_eq!(ring[1].locked, true); + assert!(!ring[0].locked); + assert!(ring[1].locked); // Both locked let mut ring = test_deque(&[(0, true), (1, false), (2, true)]); diff --git a/komorebi/src/monitor_reconciliator/mod.rs b/komorebi/src/monitor_reconciliator/mod.rs index d0eb8026..4d47c484 100644 --- a/komorebi/src/monitor_reconciliator/mod.rs +++ b/komorebi/src/monitor_reconciliator/mod.rs @@ -801,7 +801,7 @@ mod tests { let wm = match WindowManager::new(receiver, Some(socket_path.clone())) { Ok(manager) => manager, Err(e) => { - panic!("Failed to create WindowManager: {}", e); + panic!("Failed to create WindowManager: {e}"); } }; @@ -829,7 +829,7 @@ mod tests { Ok(notification) => { assert_eq!(notification, MonitorNotification::ResolutionScalingChanged); } - Err(e) => panic!("Failed to receive MonitorNotification: {}", e), + Err(e) => panic!("Failed to receive MonitorNotification: {e}"), } } @@ -849,7 +849,7 @@ mod tests { for _ in 0..20 { let notification = match receiver.try_recv() { Ok(notification) => notification, - Err(e) => panic!("Failed to receive MonitorNotification: {}", e), + Err(e) => panic!("Failed to receive MonitorNotification: {e}"), }; assert_eq!( notification, @@ -960,7 +960,7 @@ mod tests { Ok(notification) => { assert_eq!(notification, MonitorNotification::DisplayConnectionChange); } - Err(e) => panic!("Failed to receive MonitorNotification: {}", e), + Err(e) => panic!("Failed to receive MonitorNotification: {e}"), } } diff --git a/komorebi/src/windows_api.rs b/komorebi/src/windows_api.rs index 27de5285..2409b1a4 100644 --- a/komorebi/src/windows_api.rs +++ b/komorebi/src/windows_api.rs @@ -1180,6 +1180,7 @@ impl WindowsApi { #[allow(dead_code)] pub fn enable_focus_follows_mouse() -> Result<()> { + #[allow(clippy::manual_dangling_ptr)] Self::system_parameters_info_w( SPI_SETACTIVEWINDOWTRACKING, 0, diff --git a/komorebic/src/main.rs b/komorebic/src/main.rs index 268ef29d..13f46024 100644 --- a/komorebic/src/main.rs +++ b/komorebic/src/main.rs @@ -92,8 +92,7 @@ lazy_static! { assert!( whkd_config_home.is_dir(), - "$Env:WHKD_CONFIG_HOME is set to '{}', which is not a valid directory", - home_path + "$Env:WHKD_CONFIG_HOME is set to '{home_path}', which is not a valid directory" ); whkd_config_home