summaryrefslogtreecommitdiff
path: root/client/src/window.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-01-27 15:26:00 +0100
committermetamuffin <metamuffin@disroot.org>2025-01-27 15:26:00 +0100
commitc121d94f0b27bc04ffbdca55cd0939c1401d5a2e (patch)
tree67ac9da1f994c24b9a3e8e8d2adc2e334d2e34a5 /client/src/window.rs
parent6b5c44d58e6c6d3df360396a0897290fc603699b (diff)
downloadweareserver-c121d94f0b27bc04ffbdca55cd0939c1401d5a2e.tar
weareserver-c121d94f0b27bc04ffbdca55cd0939c1401d5a2e.tar.bz2
weareserver-c121d94f0b27bc04ffbdca55cd0939c1401d5a2e.tar.zst
clippy: fixes and ignores
Diffstat (limited to 'client/src/window.rs')
-rw-r--r--client/src/window.rs32
1 files changed, 13 insertions, 19 deletions
diff --git a/client/src/window.rs b/client/src/window.rs
index dcfb1e8..665aa01 100644
--- a/client/src/window.rs
+++ b/client/src/window.rs
@@ -96,18 +96,15 @@ impl ApplicationHandler for WindowState {
return;
}
if event.state == ElementState::Pressed {
- match event.physical_key {
- PhysicalKey::Code(KeyCode::Escape) => {
- win.set_cursor_grab(if self.lock {
- CursorGrabMode::None
- } else {
- CursorGrabMode::Locked
- })
- .unwrap();
- self.lock = !self.lock;
- win.set_cursor(CursorIcon::Default);
- }
- _ => (),
+ if let PhysicalKey::Code(KeyCode::Escape) = event.physical_key {
+ win.set_cursor_grab(if self.lock {
+ CursorGrabMode::None
+ } else {
+ CursorGrabMode::Locked
+ })
+ .unwrap();
+ self.lock = !self.lock;
+ win.set_cursor(CursorIcon::Default);
}
}
sta.input_state.move_dir += match event.physical_key {
@@ -141,14 +138,11 @@ impl ApplicationHandler for WindowState {
event: winit::event::DeviceEvent,
) {
if let Some((_win, sta)) = &mut self.window {
- match event {
- DeviceEvent::MouseMotion { delta } => {
- if self.lock {
- sta.input_state.mouse_acc.x += delta.0 as f32;
- sta.input_state.mouse_acc.y += delta.1 as f32;
- }
+ if let DeviceEvent::MouseMotion { delta } = event {
+ if self.lock {
+ sta.input_state.mouse_acc.x += delta.0 as f32;
+ sta.input_state.mouse_acc.y += delta.1 as f32;
}
- _ => (),
}
}
}