diff --git a/leptos_macro/src/view/mod.rs b/leptos_macro/src/view/mod.rs index 475f8aef1..d00cfaf93 100644 --- a/leptos_macro/src/view/mod.rs +++ b/leptos_macro/src/view/mod.rs @@ -308,7 +308,7 @@ pub(crate) fn element_to_tokens( parent_type, &attributes[0], global_class, - is_custom + is_custom, )) } else { let nodes = attributes.iter().map(|node| { @@ -375,7 +375,7 @@ fn attribute_to_tokens( node: &NodeAttribute, // TODO global_class support _global_class: Option<&TokenTree>, - is_custom: bool + is_custom: bool, ) -> TokenStream { match node { NodeAttribute::Block(node) => { @@ -448,7 +448,7 @@ fn attribute_to_tokens( prop_to_tokens(node, prop.into_token_stream(), name) } // circumstances in which we just do unchecked attributes - // 1) custom elements, which can have any attributes + // 1) custom elements, which can have any attributes // 2) custom attributes and data attributes (so, anything with - in it) else if is_custom || (name.contains('-') && !name.starts_with("aria-")) diff --git a/reactive_stores_macro/src/lib.rs b/reactive_stores_macro/src/lib.rs index cb877859b..804dcba0e 100644 --- a/reactive_stores_macro/src/lib.rs +++ b/reactive_stores_macro/src/lib.rs @@ -5,8 +5,8 @@ use syn::{ parse::{Parse, ParseStream, Parser}, punctuated::Punctuated, token::Comma, - Data, Field, Fields, Generics, Ident, Meta, MetaList, Result, Visibility, - WhereClause, Type, Token, Index, + Data, Field, Fields, Generics, Ident, Index, Meta, MetaList, Result, Token, + Type, Visibility, WhereClause, }; #[proc_macro_error] @@ -39,10 +39,9 @@ impl Parse for Model { syn::Fields::Named(fields) => { fields.named.into_iter().collect::>() } - syn::Fields::Unnamed(fields) => fields - .unnamed - .into_iter() - .collect::>(), + syn::Fields::Unnamed(fields) => { + fields.unnamed.into_iter().collect::>() + } }; Ok(Self { @@ -75,7 +74,17 @@ impl Parse for SubfieldMode { } #[allow(clippy::too_many_arguments)] -fn field_to_tokens(idx: usize, include_body: bool, modes: Option<&[SubfieldMode]>, library_path: &proc_macro2::TokenStream, orig_ident: Option<&Ident>, generics: &Generics, any_store_field: &Ident, struct_name: &Ident, ty: &Type) -> proc_macro2::TokenStream { +fn field_to_tokens( + idx: usize, + include_body: bool, + modes: Option<&[SubfieldMode]>, + library_path: &proc_macro2::TokenStream, + orig_ident: Option<&Ident>, + generics: &Generics, + any_store_field: &Ident, + struct_name: &Ident, + ty: &Type, +) -> proc_macro2::TokenStream { let ident = if orig_ident.is_none() { let idx = Ident::new(&format!("field{idx}"), Span::call_site()); quote! { #idx } @@ -105,9 +114,14 @@ fn field_to_tokens(idx: usize, include_body: bool, modes: Option<&[SubfieldMode] } } else { quote! { #signature; } - } + }; } else { - abort!(orig_ident.map(|ident| ident.span()).unwrap_or_else(Span::call_site), "multiple modes not currently supported"); + abort!( + orig_ident + .map(|ident| ident.span()) + .unwrap_or_else(Span::call_site), + "multiple modes not currently supported" + ); } } @@ -191,7 +205,8 @@ impl ToTokens for Model { }); // implement that trait for all StoreFields - let (trait_fields, read_fields): (Vec<_>, Vec<_>) = all_field_data.unzip(); + let (trait_fields, read_fields): (Vec<_>, Vec<_>) = + all_field_data.unzip(); // read access tokens.extend(quote! { diff --git a/router_macro/tests/path.rs b/router_macro/tests/path.rs index adb7666c9..125f77611 100644 --- a/router_macro/tests/path.rs +++ b/router_macro/tests/path.rs @@ -1,6 +1,4 @@ -use leptos_router::ParamSegment; -use leptos_router::StaticSegment; -use leptos_router::WildcardSegment; +use leptos_router::{ParamSegment, StaticSegment, WildcardSegment}; use leptos_router_macro::path; #[test] @@ -52,7 +50,6 @@ fn parses_rfc3976_unreserved() { assert_eq!(output, (StaticSegment("-._~"),)); } - #[test] fn parses_rfc3976_pchar_other() { let output = path!("/@");