Skip to content

Commit

Permalink
fix: allow non_snake_case and dead_code lints to run within compo…
Browse files Browse the repository at this point in the history
…nent functions
  • Loading branch information
yescallop committed Nov 5, 2024
1 parent 8252655 commit f68c42b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion leptos_macro/src/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1211,7 +1211,10 @@ fn prop_to_doc(
}

pub fn unmodified_fn_name_from_fn_name(ident: &Ident) -> Ident {
Ident::new(&format!("__{ident}"), ident.span())
Ident::new(
&format!("__{}", ident.to_string().to_case(Snake)),
ident.span(),
)
}

/// Converts all `impl Trait`s in a function signature to use generic params instead.
Expand Down
4 changes: 2 additions & 2 deletions leptos_macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -670,14 +670,14 @@ fn component_macro(
#expanded

#[doc(hidden)]
#[allow(non_snake_case, dead_code, clippy::too_many_arguments, clippy::needless_lifetimes)]
#[allow(clippy::too_many_arguments, clippy::needless_lifetimes)]
#unexpanded
}
} else if let Ok(mut dummy) = dummy {
dummy.sig.ident = unmodified_fn_name_from_fn_name(&dummy.sig.ident);
quote! {
#[doc(hidden)]
#[allow(non_snake_case, dead_code, clippy::too_many_arguments, clippy::needless_lifetimes)]
#[allow(clippy::too_many_arguments, clippy::needless_lifetimes)]
#dummy
}
} else {
Expand Down

0 comments on commit f68c42b

Please sign in to comment.