clippy: clean up all warnings

Mostly `cargo clippy --fix`: needless borrows, redundant field names,
match -> if let, io::Error::other, Option::filter/map, let chains, c""
literals. By hand: drop unused impl lifetimes, a type alias for the
font preload map, Iterator::find in next_buffer, contains_key, and
allow new_ret_no_self where constructors intentionally return the
boxed/generic wrapper type.

No functional change; tests and release build unchanged.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Bendik Aagaard Lynghaug
2026-10-03 09:20:25 +00:00
co-authored by Claude Fable 5.1
parent 42ffe9c492
commit 1c6a536026
20 changed files with 153 additions and 190 deletions
+29 -44
View File
@@ -133,19 +133,16 @@ impl State {
Ok(token) => token,
Err(_) => return,
};
match (
if let (Some(surface), Some(activation)) = (
&self.main_surface.wl_surface,
&self.protocols.xdg_activation,
) {
(Some(surface), Some(activation)) => {
activation.activate(key, surface);
let activation_token = activation.get_activation_token(qh, ());
activation_token.commit();
unsafe {
env::remove_var("XDG_ACTIVATION_TOKEN");
}
activation.activate(key, surface);
let activation_token = activation.get_activation_token(qh, ());
activation_token.commit();
unsafe {
env::remove_var("XDG_ACTIVATION_TOKEN");
}
_ => (),
}
}
}
@@ -333,9 +330,8 @@ impl Dispatch<wl_callback::WlCallback, ()> for State {
_: &Connection,
_: &QueueHandle<Self>,
) {
match event {
wl_callback::Event::Done { callback_data: _ } => state.ready = true,
_ => {}
if let wl_callback::Event::Done { callback_data: _ } = event {
state.ready = true
}
}
}
@@ -483,8 +479,8 @@ impl Dispatch<zwlr_layer_surface_v1::ZwlrLayerSurfaceV1, ()> for State {
&Geometry {
x: 0,
y: 0,
width: width as u32,
height: height as u32,
width,
height,
},
state,
);
@@ -676,13 +672,11 @@ impl Dispatch<wl_keyboard::WlKeyboard, ()> for State {
state.running = false;
return;
}
if repeats {
if let Event::KeyEvent(k) = ev {
state
.keyrepeat_sender
.send(RepeatMessage::KeyEvent(k))
.unwrap();
}
if repeats && let Event::KeyEvent(k) = ev {
state
.keyrepeat_sender
.send(RepeatMessage::KeyEvent(k))
.unwrap();
}
state.dirty = true;
}
@@ -742,8 +736,8 @@ impl Dispatch<wl_pointer::WlPointer, ()> for State {
state.pointer = Some((surface_x, surface_y));
}
wl_pointer::Event::Leave { .. } => state.pointer = None,
wl_pointer::Event::Axis { axis, value, .. } => match state.pointer {
Some((x, y)) => {
wl_pointer::Event::Axis { axis, value, .. } => {
if let Some((x, y)) = state.pointer {
let axis = match axis {
WEnum::Value(wl_pointer::Axis::VerticalScroll) => {
PointerButton::ScrollVertical(value)
@@ -758,24 +752,22 @@ impl Dispatch<wl_pointer::WlPointer, ()> for State {
let geo = widget.geometry();
if geo.contains(pos) {
let pos = (pos.0 - geo.x, pos.1 - geo.y);
let ev = Event::PointerEvent(PointerEvent {
button: axis,
pos: pos,
});
let ev = Event::PointerEvent(PointerEvent { button: axis, pos });
widget.event(&ev);
state.dirty = true;
break;
}
}
}
_ => (),
},
}
wl_pointer::Event::Button {
button,
state: button_state,
..
} => match (button, button_state, state.pointer) {
(button, WEnum::Value(wl_pointer::ButtonState::Pressed), Some((x, y))) => {
} => {
if let (button, WEnum::Value(wl_pointer::ButtonState::Pressed), Some((x, y))) =
(button, button_state, state.pointer)
{
let button = match button {
BTN_LEFT => PointerButton::Left,
BTN_RIGHT => PointerButton::Right,
@@ -787,18 +779,14 @@ impl Dispatch<wl_pointer::WlPointer, ()> for State {
let geo = widget.geometry();
if geo.contains(pos) {
let pos = (pos.0 - geo.x, pos.1 - geo.y);
let ev = Event::PointerEvent(PointerEvent {
button: button,
pos: pos,
});
let ev = Event::PointerEvent(PointerEvent { button, pos });
widget.event(&ev);
state.dirty = true;
break;
}
}
}
_ => (),
},
}
_ => (),
}
}
@@ -861,14 +849,11 @@ impl Dispatch<xdg_activation_token_v1::XdgActivationTokenV1, ()> for State {
_: &Connection,
_: &QueueHandle<Self>,
) {
match event {
xdg_activation_token_v1::Event::Done { token } => {
let ev = Event::TokenUpdate(token);
for widget in state.widgets.iter_mut() {
widget.event(&ev);
}
if let xdg_activation_token_v1::Event::Done { token } = event {
let ev = Event::TokenUpdate(token);
for widget in state.widgets.iter_mut() {
widget.event(&ev);
}
_ => (),
}
}
}