Add #[doc(hidden)] on derive generated items. (#189)

This commit is contained in:
Charles Lew 2023-05-31 22:46:00 +08:00 committed by GitHub
parent 8391afa876
commit df5262b19c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -538,6 +538,7 @@ fn generate_assert_no_padding(input: &DeriveInput) -> Result<TokenStream> {
}; };
Ok(quote_spanned! {span => const _: fn() = || { Ok(quote_spanned! {span => const _: fn() = || {
#[doc(hidden)]
struct TypeWithoutPadding([u8; #size_sum]); struct TypeWithoutPadding([u8; #size_sum]);
let _ = ::core::mem::transmute::<#struct_type, TypeWithoutPadding>; let _ = ::core::mem::transmute::<#struct_type, TypeWithoutPadding>;
};}) };})
@ -554,6 +555,7 @@ fn generate_fields_are_trait(
let field_types = get_field_types(&fields); let field_types = get_field_types(&fields);
Ok(quote_spanned! {span => #(const _: fn() = || { Ok(quote_spanned! {span => #(const _: fn() = || {
#[allow(clippy::missing_const_for_fn)] #[allow(clippy::missing_const_for_fn)]
#[doc(hidden)]
fn check #impl_generics () #where_clause { fn check #impl_generics () #where_clause {
fn assert_impl<T: #trait_>() {} fn assert_impl<T: #trait_>() {}
assert_impl::<#field_types>(); assert_impl::<#field_types>();