From e1f3be64162ebbfd93531d476eea720da4114c44 Mon Sep 17 00:00:00 2001 From: Saber Haj Rabiee Date: Tue, 9 Jul 2024 05:51:01 -0700 Subject: [PATCH] chore: cargo fmt (#2672) --- leptos_config/tests/config.rs | 12 ++---------- leptos_macro/src/view/component_builder.rs | 12 ++++++++---- reactive_graph/src/signal/rw.rs | 2 +- router/src/components.rs | 18 +++++++++++------- router/src/form.rs | 19 ++++++++----------- 5 files changed, 30 insertions(+), 33 deletions(-) diff --git a/leptos_config/tests/config.rs b/leptos_config/tests/config.rs index 7c076c6de..69c9630f4 100644 --- a/leptos_config/tests/config.rs +++ b/leptos_config/tests/config.rs @@ -46,11 +46,7 @@ async fn get_configuration_from_file_ok() { ("LEPTOS_RELOAD_PORT", None::<&str>), ("LEPTOS_RELOAD_EXTERNAL_PORT", None::<&str>), ], - async { - get_configuration(Some(&path_s)) - .unwrap() - .leptos_options - }, + async { get_configuration(Some(&path_s)).unwrap().leptos_options }, ) .await; @@ -106,11 +102,7 @@ async fn get_config_from_file_ok() { ("LEPTOS_RELOAD_PORT", None::<&str>), ("LEPTOS_RELOAD_EXTERNAL_PORT", None::<&str>), ], - async { - get_config_from_file(&cargo_tmp) - .unwrap() - .leptos_options - }, + async { get_config_from_file(&cargo_tmp).unwrap().leptos_options }, ) .await; diff --git a/leptos_macro/src/view/component_builder.rs b/leptos_macro/src/view/component_builder.rs index b611ac5a3..77ab9ebdd 100644 --- a/leptos_macro/src/view/component_builder.rs +++ b/leptos_macro/src/view/component_builder.rs @@ -2,9 +2,11 @@ use super::{fragment_to_tokens, TagType}; use crate::view::attribute_absolute; use proc_macro2::{Ident, TokenStream, TokenTree}; use quote::{format_ident, quote, quote_spanned}; -use rstml::node::{KeyedAttributeValue, NodeAttribute, NodeBlock, NodeElement, NodeName}; +use rstml::node::{ + KeyedAttributeValue, NodeAttribute, NodeBlock, NodeElement, NodeName, +}; use std::collections::HashMap; -use syn::{spanned::Spanned, Expr, ExprRange, RangeLimits, Stmt, ExprPath}; +use syn::{spanned::Spanned, Expr, ExprPath, ExprRange, RangeLimits, Stmt}; pub(crate) fn component_to_tokens( node: &NodeElement, @@ -90,9 +92,11 @@ pub(crate) fn component_to_tokens( return None; } - let KeyedAttributeValue::Binding(binding) = &attr.possible_value else { + let KeyedAttributeValue::Binding(binding) = &attr.possible_value + else { if let Some(ident) = attr.key.to_string().strip_prefix("let:") { - let ident1 = format_ident!("{ident}", span = attr.key.span()); + let ident1 = + format_ident!("{ident}", span = attr.key.span()); return Some(quote! { #ident1 }); } else { return None; diff --git a/reactive_graph/src/signal/rw.rs b/reactive_graph/src/signal/rw.rs index 6be71ca42..79ea823d2 100644 --- a/reactive_graph/src/signal/rw.rs +++ b/reactive_graph/src/signal/rw.rs @@ -120,7 +120,7 @@ impl Debug for RwSignal { } } -impl Default for RwSignal { +impl Default for RwSignal { #[track_caller] fn default() -> Self { Self::new(T::default()) diff --git a/router/src/components.rs b/router/src/components.rs index d68d33fce..968772a19 100644 --- a/router/src/components.rs +++ b/router/src/components.rs @@ -1,5 +1,4 @@ -pub use super::link::*; -pub use super::form::*; +pub use super::{form::*, link::*}; #[cfg(feature = "ssr")] use crate::location::RequestUrl; pub use crate::nested_router::Outlet; @@ -20,7 +19,7 @@ use reactive_graph::{ owner::{provide_context, use_context, Owner}, signal::ArcRwSignal, traits::{GetUntracked, ReadUntracked, Set}, - wrappers::write::SignalSetter, + wrappers::write::SignalSetter, }; use std::{ borrow::Cow, @@ -296,7 +295,6 @@ where NestedRoute::new(path, view, ssr) } - #[component] pub fn ParentRoute( path: Segments, @@ -330,7 +328,7 @@ where let condition = condition.clone(); let redirect_path = redirect_path.clone(); let view = view.clone(); - (view! { + (view! { {move || { match condition() { @@ -354,7 +352,13 @@ pub fn ProtectedParentRoute( redirect_path: PathFn, children: RouteChildren, #[prop(optional)] ssr: SsrMode, -) -> NestedRoute AnyView + Send + Clone, Dom> +) -> NestedRoute< + Segments, + Children, + (), + impl Fn() -> AnyView + Send + Clone, + Dom, +> where ViewFn: Fn() -> View + Send + Clone + 'static, View: IntoView + 'static, @@ -367,7 +371,7 @@ where let condition = condition.clone(); let redirect_path = redirect_path.clone(); let view = view.clone(); - (view! { + (view! { {move || { match condition() { diff --git a/router/src/form.rs b/router/src/form.rs index 09c814926..7b2e11f1f 100644 --- a/router/src/form.rs +++ b/router/src/form.rs @@ -1,17 +1,14 @@ -use std::sync::Arc; - -use leptos::html::form; -use leptos::spawn::spawn_local; -use leptos::{ev, prelude::*}; -use std::error::Error; +use crate::{ + components::ToHref, + hooks::{has_router, use_navigate, use_resolved_path}, + location::{BrowserUrl, LocationProvider}, + NavigateOptions, +}; +use leptos::{ev, html::form, prelude::*, spawn::spawn_local}; +use std::{error::Error, sync::Arc}; use wasm_bindgen::{JsCast, UnwrapThrowExt}; use web_sys::{FormData, RequestRedirect, Response}; -use crate::components::ToHref; -use crate::hooks::{has_router, use_navigate, use_resolved_path}; -use crate::location::{BrowserUrl, LocationProvider}; -use crate::NavigateOptions; - type OnFormData = Arc; type OnResponse = Arc; type OnError = Arc;