mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-10 06:44:17 +00:00
chore: fmt
This commit is contained in:
parent
8635887ca7
commit
6be090079f
3 changed files with 29 additions and 17 deletions
|
@ -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-"))
|
||||
|
|
|
@ -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::<Vec<_>>()
|
||||
}
|
||||
syn::Fields::Unnamed(fields) => fields
|
||||
.unnamed
|
||||
.into_iter()
|
||||
.collect::<Vec<_>>(),
|
||||
syn::Fields::Unnamed(fields) => {
|
||||
fields.unnamed.into_iter().collect::<Vec<_>>()
|
||||
}
|
||||
};
|
||||
|
||||
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! {
|
||||
|
|
|
@ -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!("/@");
|
||||
|
|
Loading…
Reference in a new issue