From 364654e1fd3e90afa68f5ccd4128c3a6d9858742 Mon Sep 17 00:00:00 2001 From: Evan Almloff Date: Thu, 31 Aug 2023 16:43:24 -0500 Subject: [PATCH] fix clippy with events --- packages/html/src/events.rs | 108 ++++++++++++++++++------------------ packages/web/src/event.rs | 2 +- 2 files changed, 55 insertions(+), 55 deletions(-) diff --git a/packages/html/src/events.rs b/packages/html/src/events.rs index 2d27f583c..de685b3cc 100644 --- a/packages/html/src/events.rs +++ b/packages/html/src/events.rs @@ -105,111 +105,111 @@ pub trait HtmlEventConverter: Send + Sync { fn convert_wheel_data(&self, event: &PlatformEventData) -> WheelData; } -impl Into for &PlatformEventData { - fn into(self) -> AnimationData { - with_event_converter(|c| c.convert_animation_data(self)) +impl From<&PlatformEventData> for AnimationData { + fn from(val: &PlatformEventData) -> Self { + with_event_converter(|c| c.convert_animation_data(val)) } } -impl Into for &PlatformEventData { - fn into(self) -> ClipboardData { - with_event_converter(|c| c.convert_clipboard_data(self)) +impl From<&PlatformEventData> for ClipboardData { + fn from(val: &PlatformEventData) -> Self { + with_event_converter(|c| c.convert_clipboard_data(val)) } } -impl Into for &PlatformEventData { - fn into(self) -> CompositionData { - with_event_converter(|c| c.convert_composition_data(self)) +impl From<&PlatformEventData> for CompositionData { + fn from(val: &PlatformEventData) -> Self { + with_event_converter(|c| c.convert_composition_data(val)) } } -impl Into for &PlatformEventData { - fn into(self) -> DragData { - with_event_converter(|c| c.convert_drag_data(self)) +impl From<&PlatformEventData> for DragData { + fn from(val: &PlatformEventData) -> Self { + with_event_converter(|c| c.convert_drag_data(val)) } } -impl Into for &PlatformEventData { - fn into(self) -> FocusData { - with_event_converter(|c| c.convert_focus_data(self)) +impl From<&PlatformEventData> for FocusData { + fn from(val: &PlatformEventData) -> Self { + with_event_converter(|c| c.convert_focus_data(val)) } } -impl Into for &PlatformEventData { - fn into(self) -> FormData { - with_event_converter(|c| c.convert_form_data(self)) +impl From<&PlatformEventData> for FormData { + fn from(val: &PlatformEventData) -> Self { + with_event_converter(|c| c.convert_form_data(val)) } } -impl Into for &PlatformEventData { - fn into(self) -> ImageData { - with_event_converter(|c| c.convert_image_data(self)) +impl From<&PlatformEventData> for ImageData { + fn from(val: &PlatformEventData) -> Self { + with_event_converter(|c| c.convert_image_data(val)) } } -impl Into for &PlatformEventData { - fn into(self) -> KeyboardData { - with_event_converter(|c| c.convert_keyboard_data(self)) +impl From<&PlatformEventData> for KeyboardData { + fn from(val: &PlatformEventData) -> Self { + with_event_converter(|c| c.convert_keyboard_data(val)) } } -impl Into for &PlatformEventData { - fn into(self) -> MediaData { - with_event_converter(|c| c.convert_media_data(self)) +impl From<&PlatformEventData> for MediaData { + fn from(val: &PlatformEventData) -> Self { + with_event_converter(|c| c.convert_media_data(val)) } } -impl Into for &PlatformEventData { - fn into(self) -> MountedData { - with_event_converter(|c| c.convert_mounted_data(self)) +impl From<&PlatformEventData> for MountedData { + fn from(val: &PlatformEventData) -> Self { + with_event_converter(|c| c.convert_mounted_data(val)) } } -impl Into for &PlatformEventData { - fn into(self) -> MouseData { - with_event_converter(|c| c.convert_mouse_data(self)) +impl From<&PlatformEventData> for MouseData { + fn from(val: &PlatformEventData) -> Self { + with_event_converter(|c| c.convert_mouse_data(val)) } } -impl Into for &PlatformEventData { - fn into(self) -> PointerData { - with_event_converter(|c| c.convert_pointer_data(self)) +impl From<&PlatformEventData> for PointerData { + fn from(val: &PlatformEventData) -> Self { + with_event_converter(|c| c.convert_pointer_data(val)) } } -impl Into for &PlatformEventData { - fn into(self) -> ScrollData { - with_event_converter(|c| c.convert_scroll_data(self)) +impl From<&PlatformEventData> for ScrollData { + fn from(val: &PlatformEventData) -> Self { + with_event_converter(|c| c.convert_scroll_data(val)) } } -impl Into for &PlatformEventData { - fn into(self) -> SelectionData { - with_event_converter(|c| c.convert_selection_data(self)) +impl From<&PlatformEventData> for SelectionData { + fn from(val: &PlatformEventData) -> Self { + with_event_converter(|c| c.convert_selection_data(val)) } } -impl Into for &PlatformEventData { - fn into(self) -> ToggleData { - with_event_converter(|c| c.convert_toggle_data(self)) +impl From<&PlatformEventData> for ToggleData { + fn from(val: &PlatformEventData) -> Self { + with_event_converter(|c| c.convert_toggle_data(val)) } } -impl Into for &PlatformEventData { - fn into(self) -> TouchData { - with_event_converter(|c| c.convert_touch_data(self)) +impl From<&PlatformEventData> for TouchData { + fn from(val: &PlatformEventData) -> Self { + with_event_converter(|c| c.convert_touch_data(val)) } } -impl Into for &PlatformEventData { - fn into(self) -> TransitionData { - with_event_converter(|c| c.convert_transition_data(self)) +impl From<&PlatformEventData> for TransitionData { + fn from(val: &PlatformEventData) -> Self { + with_event_converter(|c| c.convert_transition_data(val)) } } -impl Into for &PlatformEventData { - fn into(self) -> WheelData { - with_event_converter(|c| c.convert_wheel_data(self)) +impl From<&PlatformEventData> for WheelData { + fn from(val: &PlatformEventData) -> Self { + with_event_converter(|c| c.convert_wheel_data(val)) } } diff --git a/packages/web/src/event.rs b/packages/web/src/event.rs index 8767b6a35..c1e28c354 100644 --- a/packages/web/src/event.rs +++ b/packages/web/src/event.rs @@ -162,7 +162,7 @@ impl WebEventExt for dioxus_html::AnimationData { impl WebEventExt for dioxus_html::ClipboardData { fn web_event(&self) -> &web_sys::Event { - &self + self .downcast::() .expect("event should be a web_sys::Event") }