From 487fdce9a97372adb6f6ff0fcdc92045dd44d6a7 Mon Sep 17 00:00:00 2001 From: Baptiste de Montangon Date: Thu, 22 Aug 2024 22:49:30 +0200 Subject: [PATCH] fixed some warnings and an error with a untyped into --- src/core/element_maybe_signal.rs | 8 ++++---- src/use_color_mode.rs | 4 ++-- src/use_timeout_fn.rs | 3 --- src/use_web_notification.rs | 9 ++++----- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/core/element_maybe_signal.rs b/src/core/element_maybe_signal.rs index 866c618..6c79465 100644 --- a/src/core/element_maybe_signal.rs +++ b/src/core/element_maybe_signal.rs @@ -64,7 +64,7 @@ where fn with(&self, f: impl FnOnce(&Option) -> O) -> O { match self { - Self::Static(t) => f(&t), + Self::Static(t) => f(t), Self::Dynamic(s) => { let value = s.get(); f(&value) @@ -75,7 +75,7 @@ where fn try_with(&self, f: impl FnOnce(&Option) -> O) -> Option { match self { - Self::Static(t) => Some(f(&t)), + Self::Static(t) => Some(f(t)), Self::Dynamic(s) => s.try_with(f), _ => unreachable!(), } @@ -90,7 +90,7 @@ where fn with_untracked(&self, f: impl FnOnce(&Option) -> O) -> O { match self { - Self::Static(t) => f(&t), + Self::Static(t) => f(t), Self::Dynamic(s) => s.with_untracked(f), _ => unreachable!(), } @@ -98,7 +98,7 @@ where fn try_with_untracked(&self, f: impl FnOnce(&Option) -> O) -> Option { match self { - Self::Static(t) => Some(f(&t)), + Self::Static(t) => Some(f(t)), Self::Dynamic(s) => s.try_with_untracked(f), _ => unreachable!(), } diff --git a/src/use_color_mode.rs b/src/use_color_mode.rs index 666f42b..2760fbf 100644 --- a/src/use_color_mode.rs +++ b/src/use_color_mode.rs @@ -447,8 +447,8 @@ where /// If specified this will override the default behavior. /// To get the default behaviour back you can call the provided `default_handler` function. /// It takes two parameters: - /// - `mode: ColorMode`: The color mode to change to. - /// -`default_handler: Arc`: The default handler that would have been called if the `on_changed` handler had not been specified. + /// - `mode: ColorMode`: The color mode to change to. + /// -`default_handler: Arc`: The default handler that would have been called if the `on_changed` handler had not been specified. on_changed: OnChangedFn, /// When provided, `useStorage` will be skipped. diff --git a/src/use_timeout_fn.rs b/src/use_timeout_fn.rs index 2392e37..e18cb3a 100644 --- a/src/use_timeout_fn.rs +++ b/src/use_timeout_fn.rs @@ -52,12 +52,9 @@ where { use leptos::leptos_dom::helpers::TimeoutHandle; use leptos::prelude::diagnostics::SpecialNonReactiveZone; - use std::cell::Cell; use std::sync::{Arc, Mutex}; use std::time::Duration; - let delay = delay.into(); - let timer = Arc::new(Mutex::new(None::)); let clear = { diff --git a/src/use_web_notification.rs b/src/use_web_notification.rs index 34f528a..ce76881 100644 --- a/src/use_web_notification.rs +++ b/src/use_web_notification.rs @@ -64,7 +64,6 @@ pub fn use_web_notification_with_options( let show = move |_: ShowOptions| (); let close = move || (); } else { - use leptos::{spawn::spawn_local, prelude::diagnostics::SpecialNonReactiveZone}; use crate::use_event_listener; use leptos::ev::visibilitychange; use wasm_bindgen::closure::Closure; @@ -75,7 +74,7 @@ pub fn use_web_notification_with_options( let on_click = Rc::clone(&options.on_click); move |e: web_sys::Event| { #[cfg(debug_assertions)] - let _z = SpecialNonReactiveZone::enter(); + let _z = leptos::prelude::diagnostics::SpecialNonReactiveZone::enter(); on_click(e); } @@ -86,7 +85,7 @@ pub fn use_web_notification_with_options( let on_close = Rc::clone(&options.on_close); move |e: web_sys::Event| { #[cfg(debug_assertions)] - let _z = SpecialNonReactiveZone::enter(); + let _z = leptos::prelude::diagnostics::SpecialNonReactiveZone::enter(); on_close(e); } @@ -97,7 +96,7 @@ pub fn use_web_notification_with_options( let on_error = Rc::clone(&options.on_error); move |e: web_sys::Event| { #[cfg(debug_assertions)] - let _z = SpecialNonReactiveZone::enter(); + let _z = leptos::prelude::diagnostics::SpecialNonReactiveZone::enter(); on_error(e); } @@ -108,7 +107,7 @@ pub fn use_web_notification_with_options( let on_show = Rc::clone(&options.on_show); move |e: web_sys::Event| { #[cfg(debug_assertions)] - let _z = SpecialNonReactiveZone::enter(); + let _z = leptos::prelude::diagnostics::SpecialNonReactiveZone::enter(); on_show(e); }