From 79e87d3ad0ed7eef20c93e97dc1b765941a5ab09 Mon Sep 17 00:00:00 2001 From: Maccesch Date: Sat, 24 Jun 2023 01:17:23 +0100 Subject: [PATCH] chore: rustfmt --- src/lib.rs | 8 ++++---- src/use_css_var.rs | 18 +++++++++++------- src/use_favicon.rs | 16 ++++++++++------ src/use_interval_fn.rs | 14 +++++++++----- 4 files changed, 34 insertions(+), 22 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 9b755fb..9d2d5d0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -21,11 +21,11 @@ pub use use_element_size::*; pub use use_resize_observer::*; mod on_click_outside; -mod use_cycle_list; -mod use_color_mode; mod use_active_element; mod use_breakpoints; +mod use_color_mode; mod use_css_var; +mod use_cycle_list; mod use_debounce_fn; mod use_element_hover; mod use_element_visibility; @@ -49,11 +49,11 @@ mod watch_throttled; mod whenever; pub use on_click_outside::*; -pub use use_cycle_list::*; -pub use use_color_mode::*; pub use use_active_element::*; pub use use_breakpoints::*; +pub use use_color_mode::*; pub use use_css_var::*; +pub use use_cycle_list::*; pub use use_debounce_fn::*; pub use use_element_hover::*; pub use use_element_visibility::*; diff --git a/src/use_css_var.rs b/src/use_css_var.rs index a75655d..4b3c346 100644 --- a/src/use_css_var.rs +++ b/src/use_css_var.rs @@ -152,13 +152,17 @@ where ); } - let _ = watch(cx, move || variable.get(), move |val, _, _| { - if let Some(el) = el_signal.get() { - let el = el.into().unchecked_into::(); - let style = el.style(); - let _ = style.set_property(&prop.get_untracked(), val); - } - }); + let _ = watch( + cx, + move || variable.get(), + move |val, _, _| { + if let Some(el) = el_signal.get() { + let el = el.into().unchecked_into::(); + let style = el.style(); + let _ = style.set_property(&prop.get_untracked(), val); + } + }, + ); (variable, set_variable) } diff --git a/src/use_favicon.rs b/src/use_favicon.rs index b1cde29..3ba0d96 100644 --- a/src/use_favicon.rs +++ b/src/use_favicon.rs @@ -90,13 +90,17 @@ pub fn use_favicon_with_options( } }; - let _ = watch(cx, move || favicon.get(), move |new_icon, prev_icon, _| { - if Some(new_icon) != prev_icon { - if let Some(new_icon) = new_icon { - apply_icon(new_icon); + let _ = watch( + cx, + move || favicon.get(), + move |new_icon, prev_icon, _| { + if Some(new_icon) != prev_icon { + if let Some(new_icon) = new_icon { + apply_icon(new_icon); + } } - } - }); + }, + ); (favicon, set_favicon) } diff --git a/src/use_interval_fn.rs b/src/use_interval_fn.rs index 27e203a..1e36e4e 100644 --- a/src/use_interval_fn.rs +++ b/src/use_interval_fn.rs @@ -110,11 +110,15 @@ where if matches!(interval, MaybeSignal::Dynamic(_)) { let resume = resume.clone(); - let stop_watch = watch(cx, move || interval.get(), move |_, _, _| { - if is_active.get() { - resume(); - } - }); + let stop_watch = watch( + cx, + move || interval.get(), + move |_, _, _| { + if is_active.get() { + resume(); + } + }, + ); on_cleanup(cx, stop_watch); }