diff --git a/src/backend/brightness_control.rs b/src/backend/brightness_control.rs index 308cb24..a527142 100644 --- a/src/backend/brightness_control.rs +++ b/src/backend/brightness_control.rs @@ -180,7 +180,7 @@ impl BackendThread> for BrightnessM let mut last = manager .display_cache .get(&id) - .and_then(|d| Some(d.value)) + .map(|d| d.value) .unwrap_or(60); let mut revert_flag = false; for operation in operations { diff --git a/src/backend/idle.rs b/src/backend/idle.rs index 034102d..95d044e 100644 --- a/src/backend/idle.rs +++ b/src/backend/idle.rs @@ -17,7 +17,6 @@ use wayland_protocols::ext::idle_notify::v1::client::ext_idle_notification_v1::{ Event, ExtIdleNotificationV1, }; use wayland_protocols::ext::idle_notify::v1::client::ext_idle_notifier_v1::ExtIdleNotifierV1; -use zbus; use zbus::conn::Builder; use zbus::message::Header; @@ -70,14 +69,11 @@ impl Dispatch for WlState { fn event( _: &mut WlState, _: &ExtIdleNotifierV1, - event: ::Event, + _: ::Event, _: &(), _: &Connection, _: &QueueHandle, ) { - match event { - _ => {} - } } } @@ -85,7 +81,7 @@ impl Dispatch for WlState { struct Inhibitor { owner: String, application: String, - reason: String, + _reason: String, } #[derive(Clone, Copy, Debug)] @@ -102,20 +98,6 @@ impl IdleStateInner { } } -impl Into for IdleStateInner { - fn into(self) -> IdleState { - if self.should_dim() { - IdleState::Dimmed - } else if self.caffeine { - IdleState::Caffeine - } else if self.dbus_inhibited { - IdleState::Inhibited - } else { - IdleState::Active - } - } -} - #[derive(Debug, Clone)] pub enum IdleState { Init(Sender), @@ -125,6 +107,20 @@ pub enum IdleState { Active, } +impl From for IdleState { + fn from(value: IdleStateInner) -> Self { + if value.should_dim() { + IdleState::Dimmed + } else if value.caffeine { + IdleState::Caffeine + } else if value.dbus_inhibited { + IdleState::Inhibited + } else { + IdleState::Active + } + } +} + #[derive(Debug, Clone)] pub enum IdleMessage { Inhibit, @@ -404,7 +400,7 @@ impl ScreenSaver { Inhibitor { owner, application: application_name, - reason: reason_for_inhibit, + _reason: reason_for_inhibit, }, ); diff --git a/src/backend/json_socket.rs b/src/backend/json_socket.rs index 06d1275..51563d2 100644 --- a/src/backend/json_socket.rs +++ b/src/backend/json_socket.rs @@ -27,7 +27,7 @@ pub enum State { } impl State { - fn try_from_value(value: i64) -> Option { + fn _try_from_value(value: i64) -> Option { match value { 5 => Some(State::Connecting), 6 => Some(State::Connected), @@ -37,7 +37,7 @@ impl State { } impl JsonSocketBackend { - async fn watch(instance: Arc>) -> Result<(), Box> { + async fn _watch(instance: Arc>) -> Result<(), Box> { let socket_address = instance .lock() .expect("Couldn't get lock") @@ -89,7 +89,7 @@ impl JsonSocketBackend { if let Some(state) = notification.get("State") && !state.is_null() { - let state = State::try_from_value(state.as_i64().unwrap_or(4)) + let state = State::_try_from_value(state.as_i64().unwrap_or(4)) .unwrap_or(State::Disconnected); instance.lock().expect("Couldn't get lock").publish(state); }