From c121d94f0b27bc04ffbdca55cd0939c1401d5a2e Mon Sep 17 00:00:00 2001 From: metamuffin Date: Mon, 27 Jan 2025 15:26:00 +0100 Subject: clippy: fixes and ignores --- client/src/window.rs | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) (limited to 'client/src/window.rs') 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; } - _ => (), } } } -- cgit v1.2.3-70-g09d2