Fix `empty_docs` warnings in `#[component]` macro (#2574)
This commit is contained in:
parent
20f4323e50
commit
6a8e4bb453
|
@ -178,6 +178,18 @@ impl ToTokens for Model {
|
||||||
);
|
);
|
||||||
|
|
||||||
let component_fn_prop_docs = generate_component_fn_prop_docs(props);
|
let component_fn_prop_docs = generate_component_fn_prop_docs(props);
|
||||||
|
let docs_and_prop_docs = if component_fn_prop_docs.is_empty() {
|
||||||
|
// Avoid generating an empty doc line in case the component has no doc and no props.
|
||||||
|
quote! {
|
||||||
|
#docs
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
quote! {
|
||||||
|
#docs
|
||||||
|
#[doc = ""]
|
||||||
|
#component_fn_prop_docs
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
let (
|
let (
|
||||||
tracing_instrument_attr,
|
tracing_instrument_attr,
|
||||||
|
@ -502,9 +514,7 @@ impl ToTokens for Model {
|
||||||
let output = quote! {
|
let output = quote! {
|
||||||
#[doc = #builder_name_doc]
|
#[doc = #builder_name_doc]
|
||||||
#[doc = ""]
|
#[doc = ""]
|
||||||
#docs
|
#docs_and_prop_docs
|
||||||
#[doc = ""]
|
|
||||||
#component_fn_prop_docs
|
|
||||||
#[derive(::leptos::typed_builder_macro::TypedBuilder #props_derive_serialize)]
|
#[derive(::leptos::typed_builder_macro::TypedBuilder #props_derive_serialize)]
|
||||||
//#[builder(doc)]
|
//#[builder(doc)]
|
||||||
#[builder(crate_module_path=::leptos::typed_builder)]
|
#[builder(crate_module_path=::leptos::typed_builder)]
|
||||||
|
@ -548,9 +558,7 @@ impl ToTokens for Model {
|
||||||
|
|
||||||
#into_view
|
#into_view
|
||||||
|
|
||||||
#docs
|
#docs_and_prop_docs
|
||||||
#[doc = ""]
|
|
||||||
#component_fn_prop_docs
|
|
||||||
#[allow(non_snake_case, clippy::too_many_arguments)]
|
#[allow(non_snake_case, clippy::too_many_arguments)]
|
||||||
#[allow(clippy::needless_lifetimes)]
|
#[allow(clippy::needless_lifetimes)]
|
||||||
#tracing_instrument_attr
|
#tracing_instrument_attr
|
||||||
|
|
Loading…
Reference in New Issue