From 952858ed85610a472fe35c02c6d8b4cf878ff83b Mon Sep 17 00:00:00 2001 From: Evan Almloff Date: Mon, 4 Nov 2024 17:35:26 -0600 Subject: [PATCH] Fix as web event --- packages/web/src/events/animation.rs | 3 +-- packages/web/src/events/clipboard.rs | 3 +-- packages/web/src/events/composition.rs | 3 +-- packages/web/src/events/drag.rs | 3 +-- packages/web/src/events/focus.rs | 3 +-- packages/web/src/events/keyboard.rs | 3 +-- packages/web/src/events/media.rs | 3 +-- packages/web/src/events/mounted.rs | 3 +-- packages/web/src/events/mouse.rs | 3 +-- packages/web/src/events/pointer.rs | 3 +-- packages/web/src/events/resize.rs | 3 +-- packages/web/src/events/selection.rs | 3 +-- packages/web/src/events/toggle.rs | 3 +-- packages/web/src/events/touch.rs | 3 +-- packages/web/src/events/wheel.rs | 6 ++---- 15 files changed, 16 insertions(+), 32 deletions(-) diff --git a/packages/web/src/events/animation.rs b/packages/web/src/events/animation.rs index 29f245c7f4..e47cce2edb 100644 --- a/packages/web/src/events/animation.rs +++ b/packages/web/src/events/animation.rs @@ -26,7 +26,6 @@ impl WebEventExt for dioxus_html::AnimationData { #[inline(always)] fn try_as_web_event(&self) -> Option { - self.downcast::>() - .map(|e| e.event.clone()) + self.downcast::().cloned() } } diff --git a/packages/web/src/events/clipboard.rs b/packages/web/src/events/clipboard.rs index 1b9a2bce36..fa243c5063 100644 --- a/packages/web/src/events/clipboard.rs +++ b/packages/web/src/events/clipboard.rs @@ -20,7 +20,6 @@ impl WebEventExt for dioxus_html::ClipboardData { #[inline(always)] fn try_as_web_event(&self) -> Option { - self.downcast::>() - .map(|e| e.event.clone()) + self.downcast::().cloned() } } diff --git a/packages/web/src/events/composition.rs b/packages/web/src/events/composition.rs index 5c44be6ab0..ce92c337e1 100644 --- a/packages/web/src/events/composition.rs +++ b/packages/web/src/events/composition.rs @@ -18,7 +18,6 @@ impl WebEventExt for dioxus_html::CompositionData { #[inline(always)] fn try_as_web_event(&self) -> Option { - self.downcast::>() - .map(|e| e.event.clone()) + self.downcast::().cloned() } } diff --git a/packages/web/src/events/drag.rs b/packages/web/src/events/drag.rs index 2be122cfb7..82769554f1 100644 --- a/packages/web/src/events/drag.rs +++ b/packages/web/src/events/drag.rs @@ -101,7 +101,6 @@ impl WebEventExt for dioxus_html::DragData { #[inline(always)] fn try_as_web_event(&self) -> Option { - self.downcast::>() - .map(|data| data.event.clone()) + self.downcast::().cloned() } } diff --git a/packages/web/src/events/focus.rs b/packages/web/src/events/focus.rs index 6089783891..bd06ebc74d 100644 --- a/packages/web/src/events/focus.rs +++ b/packages/web/src/events/focus.rs @@ -13,7 +13,6 @@ impl WebEventExt for dioxus_html::FocusData { #[inline(always)] fn try_as_web_event(&self) -> Option { - self.downcast::>() - .map(|e| e.event.clone()) + self.downcast::().cloned() } } diff --git a/packages/web/src/events/keyboard.rs b/packages/web/src/events/keyboard.rs index bbc99f98e7..57b233abaa 100644 --- a/packages/web/src/events/keyboard.rs +++ b/packages/web/src/events/keyboard.rs @@ -61,7 +61,6 @@ impl WebEventExt for dioxus_html::KeyboardData { #[inline(always)] fn try_as_web_event(&self) -> Option { - self.downcast::>() - .map(|e| e.event.clone()) + self.downcast::().cloned() } } diff --git a/packages/web/src/events/media.rs b/packages/web/src/events/media.rs index b33116ac2e..d7fbf96938 100644 --- a/packages/web/src/events/media.rs +++ b/packages/web/src/events/media.rs @@ -12,7 +12,6 @@ impl WebEventExt for dioxus_html::MediaData { #[inline(always)] fn try_as_web_event(&self) -> Option { - self.downcast::>() - .map(|e| e.event.clone()) + self.downcast::().cloned() } } diff --git a/packages/web/src/events/mounted.rs b/packages/web/src/events/mounted.rs index 5044a09eb0..b33dfc201e 100644 --- a/packages/web/src/events/mounted.rs +++ b/packages/web/src/events/mounted.rs @@ -120,7 +120,6 @@ impl WebEventExt for MountedData { #[inline(always)] fn try_as_web_event(&self) -> Option { - self.downcast::>() - .map(|e| e.event.clone()) + self.downcast::().cloned() } } diff --git a/packages/web/src/events/mouse.rs b/packages/web/src/events/mouse.rs index accb9e9dbd..2d2114627a 100644 --- a/packages/web/src/events/mouse.rs +++ b/packages/web/src/events/mouse.rs @@ -73,7 +73,6 @@ impl WebEventExt for dioxus_html::MouseData { #[inline(always)] fn try_as_web_event(&self) -> Option { - self.downcast::>() - .map(|e| e.event.clone()) + self.downcast::().cloned() } } diff --git a/packages/web/src/events/pointer.rs b/packages/web/src/events/pointer.rs index 8513bcc1bf..dc33f00b17 100644 --- a/packages/web/src/events/pointer.rs +++ b/packages/web/src/events/pointer.rs @@ -113,7 +113,6 @@ impl WebEventExt for dioxus_html::PointerData { #[inline(always)] fn try_as_web_event(&self) -> Option { - self.downcast::>() - .map(|e| e.event.clone()) + self.downcast::().cloned() } } diff --git a/packages/web/src/events/resize.rs b/packages/web/src/events/resize.rs index 77ac93f9f8..09b49e4c0e 100644 --- a/packages/web/src/events/resize.rs +++ b/packages/web/src/events/resize.rs @@ -39,8 +39,7 @@ impl WebEventExt for dioxus_html::ResizeData { #[inline(always)] fn try_as_web_event(&self) -> Option { - self.downcast::>() - .map(|e| e.event.clone()) + self.downcast::().cloned() } } diff --git a/packages/web/src/events/selection.rs b/packages/web/src/events/selection.rs index 16a87f0555..08a89ff870 100644 --- a/packages/web/src/events/selection.rs +++ b/packages/web/src/events/selection.rs @@ -12,7 +12,6 @@ impl WebEventExt for dioxus_html::SelectionData { #[inline(always)] fn try_as_web_event(&self) -> Option { - self.downcast::>() - .map(|e| e.event.clone()) + self.downcast::().cloned() } } diff --git a/packages/web/src/events/toggle.rs b/packages/web/src/events/toggle.rs index 24a5727284..d92d310006 100644 --- a/packages/web/src/events/toggle.rs +++ b/packages/web/src/events/toggle.rs @@ -12,7 +12,6 @@ impl WebEventExt for dioxus_html::ToggleData { #[inline(always)] fn try_as_web_event(&self) -> Option { - self.downcast::>() - .map(|e| e.event.clone()) + self.downcast::().cloned() } } diff --git a/packages/web/src/events/touch.rs b/packages/web/src/events/touch.rs index d8fcfc015e..487792536f 100644 --- a/packages/web/src/events/touch.rs +++ b/packages/web/src/events/touch.rs @@ -105,7 +105,6 @@ impl WebEventExt for dioxus_html::TouchData { #[inline(always)] fn try_as_web_event(&self) -> Option { - self.downcast::>() - .map(|e| e.event.clone()) + self.downcast::().cloned() } } diff --git a/packages/web/src/events/wheel.rs b/packages/web/src/events/wheel.rs index f21f6907ba..49826a1213 100644 --- a/packages/web/src/events/wheel.rs +++ b/packages/web/src/events/wheel.rs @@ -94,8 +94,7 @@ impl WebEventExt for dioxus_html::ScrollData { #[inline(always)] fn try_as_web_event(&self) -> Option { - self.downcast::>() - .map(|e| e.event.clone()) + self.downcast::().cloned() } } @@ -104,7 +103,6 @@ impl WebEventExt for dioxus_html::WheelData { #[inline(always)] fn try_as_web_event(&self) -> Option { - self.downcast::>() - .map(|e| e.event.clone()) + self.downcast::().cloned() } }