From 0eb697bbd76698af53ebe2b9b583749471b60cdd Mon Sep 17 00:00:00 2001 From: William Edwards Date: Mon, 18 Nov 2024 16:32:16 -0800 Subject: [PATCH] fix(TargetTouchpad): minor performance improvements --- src/input/target/touchpad.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/input/target/touchpad.rs b/src/input/target/touchpad.rs index 5cb6bc9..03cc9b2 100644 --- a/src/input/target/touchpad.rs +++ b/src/input/target/touchpad.rs @@ -164,13 +164,13 @@ impl TouchpadDevice { let mut events = vec![]; let cap = event.as_capability(); - let button_events: Vec = vec![ + let button_events = [ Capability::Touchpad(Touchpad::CenterPad(Touch::Button(TouchButton::Press))), Capability::Touchpad(Touchpad::LeftPad(Touch::Button(TouchButton::Press))), Capability::Touchpad(Touchpad::RightPad(Touch::Button(TouchButton::Press))), ]; - let motion_events: Vec = vec![ + let motion_events = [ Capability::Touchpad(Touchpad::CenterPad(Touch::Motion)), Capability::Touchpad(Touchpad::LeftPad(Touch::Motion)), Capability::Touchpad(Touchpad::RightPad(Touch::Motion)), @@ -191,7 +191,7 @@ impl TouchpadDevice { /// Translate the given native [Touch::Motion] event into a sereis of evdev events fn translate_motion(&mut self, event: NativeEvent) -> Vec { - let mut events = vec![]; + let mut events = Vec::with_capacity(10); // Destructure the input value let InputValue::Touch {