From 71c94566afa1b637d6215e878e36f3ec29797e27 Mon Sep 17 00:00:00 2001 From: Matthias Gabriel Date: Fri, 23 Feb 2024 06:32:51 +0100 Subject: [PATCH] make linter more happy --- src/sketch_board.rs | 16 ++++++++-------- src/tools/mod.rs | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/sketch_board.rs b/src/sketch_board.rs index df6d09f..c5aec3c 100644 --- a/src/sketch_board.rs +++ b/src/sketch_board.rs @@ -35,9 +35,9 @@ pub enum SketchBoardOutput { #[derive(Debug, Clone)] pub enum InputEvent { - MouseEvent(MouseEventMsg), - KeyEvent(KeyEventMsg), - TextEvent(TextEventMsg), + Mouse(MouseEventMsg), + Key(KeyEventMsg), + Text(TextEventMsg), } // from https://flatuicolors.com/palette/au @@ -84,7 +84,7 @@ impl SketchBoardInput { modifier: ModifierType, pos: Vec2D, ) -> SketchBoardInput { - SketchBoardInput::InputEvent(InputEvent::MouseEvent(MouseEventMsg { + SketchBoardInput::InputEvent(InputEvent::Mouse(MouseEventMsg { type_: event_type, button: button.into(), modifier, @@ -92,11 +92,11 @@ impl SketchBoardInput { })) } pub fn new_key_event(event: KeyEventMsg) -> SketchBoardInput { - SketchBoardInput::InputEvent(InputEvent::KeyEvent(event)) + SketchBoardInput::InputEvent(InputEvent::Key(event)) } pub fn new_text_event(event: TextEventMsg) -> SketchBoardInput { - SketchBoardInput::InputEvent(InputEvent::TextEvent(event)) + SketchBoardInput::InputEvent(InputEvent::Text(event)) } } @@ -118,7 +118,7 @@ impl InputEvent { } fn remap_event_coordinates(&mut self, scale: f64) { - if let InputEvent::MouseEvent(me) = self { + if let InputEvent::Mouse(me) = self { Self::screen2image(&mut me.pos, scale) }; } @@ -421,7 +421,7 @@ impl Component for SketchBoard { } SketchBoardInput::InputEvent(mut ie) => { - if let InputEvent::KeyEvent(ke) = ie { + if let InputEvent::Key(ke) = ie { if ke.key == Key::z && ke.modifier == ModifierType::CONTROL_MASK { self.handle_undo() } else if ke.key == Key::y && ke.modifier == ModifierType::CONTROL_MASK { diff --git a/src/tools/mod.rs b/src/tools/mod.rs index c52b42d..6f6ee2a 100644 --- a/src/tools/mod.rs +++ b/src/tools/mod.rs @@ -52,9 +52,9 @@ pub trait Tool { fn handle_input_event(&mut self, event: InputEvent) -> ToolUpdateResult { match event { - InputEvent::MouseEvent(e) => self.handle_mouse_event(e), - InputEvent::KeyEvent(e) => self.handle_key_event(e), - InputEvent::TextEvent(e) => self.handle_text_event(e), + InputEvent::Mouse(e) => self.handle_mouse_event(e), + InputEvent::Key(e) => self.handle_key_event(e), + InputEvent::Text(e) => self.handle_text_event(e), } }