Clippy
This commit is contained in:
@@ -180,7 +180,7 @@ impl BackendThread<BrightnessMessage, Sender<BrightnessMessage>> for BrightnessM
|
|||||||
let mut last = manager
|
let mut last = manager
|
||||||
.display_cache
|
.display_cache
|
||||||
.get(&id)
|
.get(&id)
|
||||||
.and_then(|d| Some(d.value))
|
.map(|d| d.value)
|
||||||
.unwrap_or(60);
|
.unwrap_or(60);
|
||||||
let mut revert_flag = false;
|
let mut revert_flag = false;
|
||||||
for operation in operations {
|
for operation in operations {
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ use wayland_protocols::ext::idle_notify::v1::client::ext_idle_notification_v1::{
|
|||||||
Event, ExtIdleNotificationV1,
|
Event, ExtIdleNotificationV1,
|
||||||
};
|
};
|
||||||
use wayland_protocols::ext::idle_notify::v1::client::ext_idle_notifier_v1::ExtIdleNotifierV1;
|
use wayland_protocols::ext::idle_notify::v1::client::ext_idle_notifier_v1::ExtIdleNotifierV1;
|
||||||
use zbus;
|
|
||||||
use zbus::conn::Builder;
|
use zbus::conn::Builder;
|
||||||
use zbus::message::Header;
|
use zbus::message::Header;
|
||||||
|
|
||||||
@@ -70,14 +69,11 @@ impl Dispatch<ExtIdleNotifierV1, (), WlState> for WlState {
|
|||||||
fn event(
|
fn event(
|
||||||
_: &mut WlState,
|
_: &mut WlState,
|
||||||
_: &ExtIdleNotifierV1,
|
_: &ExtIdleNotifierV1,
|
||||||
event: <ExtIdleNotifierV1 as wayland_client::Proxy>::Event,
|
_: <ExtIdleNotifierV1 as wayland_client::Proxy>::Event,
|
||||||
_: &(),
|
_: &(),
|
||||||
_: &Connection,
|
_: &Connection,
|
||||||
_: &QueueHandle<WlState>,
|
_: &QueueHandle<WlState>,
|
||||||
) {
|
) {
|
||||||
match event {
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +81,7 @@ impl Dispatch<ExtIdleNotifierV1, (), WlState> for WlState {
|
|||||||
struct Inhibitor {
|
struct Inhibitor {
|
||||||
owner: String,
|
owner: String,
|
||||||
application: String,
|
application: String,
|
||||||
reason: String,
|
_reason: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug)]
|
||||||
@@ -102,20 +98,6 @@ impl IdleStateInner {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Into<IdleState> 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)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum IdleState {
|
pub enum IdleState {
|
||||||
Init(Sender<IdleMessage>),
|
Init(Sender<IdleMessage>),
|
||||||
@@ -125,6 +107,20 @@ pub enum IdleState {
|
|||||||
Active,
|
Active,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<IdleStateInner> 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)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum IdleMessage {
|
pub enum IdleMessage {
|
||||||
Inhibit,
|
Inhibit,
|
||||||
@@ -404,7 +400,7 @@ impl ScreenSaver {
|
|||||||
Inhibitor {
|
Inhibitor {
|
||||||
owner,
|
owner,
|
||||||
application: application_name,
|
application: application_name,
|
||||||
reason: reason_for_inhibit,
|
_reason: reason_for_inhibit,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ pub enum State {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl State {
|
impl State {
|
||||||
fn try_from_value(value: i64) -> Option<State> {
|
fn _try_from_value(value: i64) -> Option<State> {
|
||||||
match value {
|
match value {
|
||||||
5 => Some(State::Connecting),
|
5 => Some(State::Connecting),
|
||||||
6 => Some(State::Connected),
|
6 => Some(State::Connected),
|
||||||
@@ -37,7 +37,7 @@ impl State {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl JsonSocketBackend {
|
impl JsonSocketBackend {
|
||||||
async fn watch(instance: Arc<Mutex<Self>>) -> Result<(), Box<dyn Error + Send + Sync>> {
|
async fn _watch(instance: Arc<Mutex<Self>>) -> Result<(), Box<dyn Error + Send + Sync>> {
|
||||||
let socket_address = instance
|
let socket_address = instance
|
||||||
.lock()
|
.lock()
|
||||||
.expect("Couldn't get lock")
|
.expect("Couldn't get lock")
|
||||||
@@ -89,7 +89,7 @@ impl JsonSocketBackend {
|
|||||||
if let Some(state) = notification.get("State")
|
if let Some(state) = notification.get("State")
|
||||||
&& !state.is_null()
|
&& !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);
|
.unwrap_or(State::Disconnected);
|
||||||
instance.lock().expect("Couldn't get lock").publish(state);
|
instance.lock().expect("Couldn't get lock").publish(state);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user