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" imports_granularity = "Crate"

View file

@ -101,12 +101,12 @@ impl Dispatch<zwlr_layer_surface_v1::ZwlrLayerSurfaceV1, ()> for State {
height, height,
} => { } => {
for output in &mut state.outputs { for output in &mut state.outputs {
if let Some(fade_surface) = &mut output.fade_surface { if let Some(fade_surface) = &mut output.fade_surface
if &fade_surface.layer_surface == obj { && &fade_surface.layer_surface == obj
fade_surface.layer_surface.ack_configure(serial); {
fade_surface.configure(&state.inner, width, height); fade_surface.layer_surface.ack_configure(serial);
break; fade_surface.configure(&state.inner, width, height);
} break;
} }
} }
} }
@ -127,23 +127,23 @@ impl Dispatch<wl_callback::WlCallback, wl_surface::WlSurface> for State {
match event { match event {
wl_callback::Event::Done { callback_data: _ } => { wl_callback::Event::Done { callback_data: _ } => {
for output in &mut state.outputs { for output in &mut state.outputs {
if let Some(fade_surface) = &mut output.fade_surface { if let Some(fade_surface) = &mut output.fade_surface
if &fade_surface.surface == surface { && &fade_surface.surface == surface
if fade_surface.is_done() { {
// All outputs are done fading if fade_surface.is_done() {
if state // All outputs are done fading
.outputs if state
.iter() .outputs
.flat_map(|o| o.fade_surface.as_ref()) .iter()
.all(|s| s.is_done()) .flat_map(|o| o.fade_surface.as_ref())
{ .all(|s| s.is_done())
state.fade_done(); {
} state.fade_done();
} else {
fade_surface.update(&state.inner);
} }
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?; let mut name_owner_stream = dbus.receive_name_owner_changed().await?;
while let Some(event) = name_owner_stream.next().await { while let Some(event) = name_owner_stream.next().await {
let args = event.args()?; let args = event.args()?;
if args.new_owner.is_none() { if args.new_owner.is_none()
if let zbus::names::BusName::Unique(name) = args.name { && let zbus::names::BusName::Unique(name) = args.name
let mut inhibitors = inhibitors.lock().unwrap(); {
if !inhibitors.is_empty() { let mut inhibitors = inhibitors.lock().unwrap();
inhibitors.retain(|inhibitor| inhibitor.client != name); if !inhibitors.is_empty() {
if inhibitors.is_empty() { inhibitors.retain(|inhibitor| inhibitor.client != name);
let _ = event_sender.send(Event::ScreensaverInhibit(false)); if inhibitors.is_empty() {
} let _ = event_sender.send(Event::ScreensaverInhibit(false));
} }
} }
} }

View file

@ -356,7 +356,7 @@ fn main() {
}) })
.unwrap(); .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 { impl Dispatch<wl_registry::WlRegistry, GlobalListContents> for State {