chore: clippy

This commit is contained in:
Vukašin Vojinović 2025-10-05 14:31:25 +02:00 committed by Jacob Kauffmann
parent 267bb837f1
commit 16abcc66e1
4 changed files with 30 additions and 31 deletions

View file

@ -1,2 +1 @@
reorder_imports = true
imports_granularity = "Crate"

View file

@ -101,12 +101,12 @@ impl Dispatch<zwlr_layer_surface_v1::ZwlrLayerSurfaceV1, ()> for State {
height,
} => {
for output in &mut state.outputs {
if let Some(fade_surface) = &mut output.fade_surface {
if &fade_surface.layer_surface == obj {
fade_surface.layer_surface.ack_configure(serial);
fade_surface.configure(&state.inner, width, height);
break;
}
if let Some(fade_surface) = &mut output.fade_surface
&& &fade_surface.layer_surface == obj
{
fade_surface.layer_surface.ack_configure(serial);
fade_surface.configure(&state.inner, width, height);
break;
}
}
}
@ -127,23 +127,23 @@ impl Dispatch<wl_callback::WlCallback, wl_surface::WlSurface> for State {
match event {
wl_callback::Event::Done { callback_data: _ } => {
for output in &mut state.outputs {
if let Some(fade_surface) = &mut output.fade_surface {
if &fade_surface.surface == surface {
if fade_surface.is_done() {
// All outputs are done fading
if state
.outputs
.iter()
.flat_map(|o| o.fade_surface.as_ref())
.all(|s| s.is_done())
{
state.fade_done();
}
} else {
fade_surface.update(&state.inner);
if let Some(fade_surface) = &mut output.fade_surface
&& &fade_surface.surface == surface
{
if fade_surface.is_done() {
// All outputs are done fading
if state
.outputs
.iter()
.flat_map(|o| o.fade_surface.as_ref())
.all(|s| s.is_done())
{
state.fade_done();
}
break;
} else {
fade_surface.update(&state.inner);
}
break;
}
}
}

View file

@ -99,14 +99,14 @@ pub async fn serve(event_sender: EventSender) -> zbus::Result<()> {
let mut name_owner_stream = dbus.receive_name_owner_changed().await?;
while let Some(event) = name_owner_stream.next().await {
let args = event.args()?;
if args.new_owner.is_none() {
if let zbus::names::BusName::Unique(name) = args.name {
let mut inhibitors = inhibitors.lock().unwrap();
if !inhibitors.is_empty() {
inhibitors.retain(|inhibitor| inhibitor.client != name);
if inhibitors.is_empty() {
let _ = event_sender.send(Event::ScreensaverInhibit(false));
}
if args.new_owner.is_none()
&& let zbus::names::BusName::Unique(name) = args.name
{
let mut inhibitors = inhibitors.lock().unwrap();
if !inhibitors.is_empty() {
inhibitors.retain(|inhibitor| inhibitor.client != name);
if inhibitors.is_empty() {
let _ = event_sender.send(Event::ScreensaverInhibit(false));
}
}
}

View file

@ -356,7 +356,7 @@ fn main() {
})
.unwrap();
while let Ok(_) = event_loop.dispatch(None, &mut state) {}
while event_loop.dispatch(None, &mut state).is_ok() {}
}
impl Dispatch<wl_registry::WlRegistry, GlobalListContents> for State {