From 7cc4917bb1f7ead6c9bc5846e3e6adee74d9389f Mon Sep 17 00:00:00 2001 From: rambip Date: Wed, 27 Sep 2023 23:34:23 +0200 Subject: [PATCH] formating --- leptos/src/callback.rs | 23 ++++++++--------------- leptos/src/lib.rs | 4 ++-- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/leptos/src/callback.rs b/leptos/src/callback.rs index 30b3b585b2..c558035d44 100644 --- a/leptos/src/callback.rs +++ b/leptos/src/callback.rs @@ -68,8 +68,6 @@ pub trait Callable { fn call(&self, input: In) -> Out; } - - /// The most basic leptos callback type. /// For how to use callbacks, see [here][crate::callback] /// @@ -132,31 +130,29 @@ impl Callable for Callback { impl From for Callback where F: Fn(In) -> T + 'static, - T: Into + 'static + T: Into + 'static, { fn from(f: F) -> Callback { Callback::new(move |x| f(x).into()) } } - // will allow to implement `Fn` for Callback in the future if needed. #[cfg(feature = "nightly")] auto trait NotRawCallback {} #[cfg(feature = "nightly")] -impl !NotRawCallback for Callback { } +impl !NotRawCallback for Callback {} #[cfg(feature = "nightly")] impl From for Callback where F: Fn(In) -> T + NotRawCallback + 'static, - T: Into + 'static + T: Into + 'static, { fn from(f: F) -> Callback { Callback::new(move |x| f(x).into()) } } - /// A callback type that implements `Copy`. /// `StoredCallback` is an alias for `StoredValue>`. /// @@ -211,7 +207,6 @@ impl Callable for SyncCallback { } } - impl Clone for SyncCallback { fn clone(&self) -> Self { Self(self.0.clone()) @@ -228,8 +223,6 @@ impl SyncCallback { } } - - #[cfg(test)] mod tests { use crate::callback::{Callback, SyncCallback}; @@ -250,16 +243,16 @@ mod tests { #[test] fn callback_from() { - let _callback : Callback<(), String> = (|()| "test").into(); + let _callback: Callback<(), String> = (|()| "test").into(); } #[test] fn callback_from_html() { - use leptos_macro::view; + use crate::html::{AnyElement, HtmlElement}; use leptos_dom::IntoView; - use crate::html::{HtmlElement, AnyElement}; + use leptos_macro::view; - let _callback : Callback> - = (|x: String| view!{

{x}

}).into(); + let _callback: Callback> = + (|x: String| view! {

{x}

}).into(); } } diff --git a/leptos/src/lib.rs b/leptos/src/lib.rs index 0403e08daa..16aea506b3 100644 --- a/leptos/src/lib.rs +++ b/leptos/src/lib.rs @@ -205,13 +205,13 @@ pub use serde; pub use serde_json; pub use show::*; pub use suspense_component::*; +mod callback; mod suspense_component; mod text_prop; mod transition; -mod callback; -pub use text_prop::TextProp; pub use callback::*; +pub use text_prop::TextProp; #[cfg(any(debug_assertions, feature = "ssr"))] #[doc(hidden)] pub use tracing;