chore: cargo fmt (#2672)

This commit is contained in:
Saber Haj Rabiee 2024-07-09 05:51:01 -07:00 committed by Greg Johnston
parent 9536480739
commit e1f3be6416
5 changed files with 30 additions and 33 deletions

View file

@ -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;

View file

@ -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;

View file

@ -120,7 +120,7 @@ impl<T> Debug for RwSignal<T> {
}
}
impl<T: Send + Sync + 'static + Default> Default for RwSignal<T> {
impl<T: Send + Sync + 'static + Default> Default for RwSignal<T> {
#[track_caller]
fn default() -> Self {
Self::new(T::default())

View file

@ -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<Segments, View, Children>(
path: Segments,
@ -330,7 +328,7 @@ where
let condition = condition.clone();
let redirect_path = redirect_path.clone();
let view = view.clone();
(view! {
(view! {
<Transition>
{move || {
match condition() {
@ -354,7 +352,13 @@ pub fn ProtectedParentRoute<Segments, ViewFn, View, C, PathFn, P, Children>(
redirect_path: PathFn,
children: RouteChildren<Children>,
#[prop(optional)] ssr: SsrMode,
) -> NestedRoute<Segments, Children, (), impl Fn() -> AnyView<Dom> + Send + Clone, Dom>
) -> NestedRoute<
Segments,
Children,
(),
impl Fn() -> AnyView<Dom> + 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! {
<Transition>
{move || {
match condition() {

View file

@ -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<dyn Fn(&FormData)>;
type OnResponse = Arc<dyn Fn(&Response)>;
type OnError = Arc<dyn Fn(&gloo_net::Error)>;