From cd894655db834884929ad258693eacaef616478c Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Sat, 5 Feb 2022 13:59:02 -0800 Subject: [PATCH] refactor(clippy): impl as_ref on wm struct --- komorebi/src/process_command.rs | 2 +- komorebi/src/process_event.rs | 2 +- komorebi/src/window_manager.rs | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/komorebi/src/process_command.rs b/komorebi/src/process_command.rs index 831f7e23..fb5506b2 100644 --- a/komorebi/src/process_command.rs +++ b/komorebi/src/process_command.rs @@ -675,7 +675,7 @@ impl WindowManager { self.process_command(message.clone())?; notify_subscribers(&serde_json::to_string(&Notification { event: NotificationEvent::Socket(message.clone()), - state: (&*self).into(), + state: self.as_ref().into(), })?)?; } diff --git a/komorebi/src/process_event.rs b/komorebi/src/process_event.rs index 06f9c38a..0c14c734 100644 --- a/komorebi/src/process_event.rs +++ b/komorebi/src/process_event.rs @@ -478,7 +478,7 @@ impl WindowManager { serde_json::to_writer_pretty(&file, &known_hwnds)?; notify_subscribers(&serde_json::to_string(&Notification { event: NotificationEvent::WindowManager(*event), - state: (&*self).into(), + state: self.as_ref().into(), })?)?; tracing::info!("processed: {}", event.window().to_string()); diff --git a/komorebi/src/window_manager.rs b/komorebi/src/window_manager.rs index 8e98e8a4..0025aaf2 100644 --- a/komorebi/src/window_manager.rs +++ b/komorebi/src/window_manager.rs @@ -81,6 +81,12 @@ pub struct State { pub border_overflow_identifiers: Vec, } +impl AsRef for WindowManager { + fn as_ref(&self) -> &Self { + self + } +} + impl From<&WindowManager> for State { fn from(wm: &WindowManager) -> Self { Self {