From 71884d23b32cc35c2e5f5c004586cb620c7dbdc1 Mon Sep 17 00:00:00 2001 From: Sam Johnson Date: Thu, 9 Mar 2023 00:15:32 -0500 Subject: [PATCH] use a module instead --- .../procedural/src/pallet/expand/doc_only.rs | 13 ++++++------- frame/support/test/pallet/src/lib.rs | 1 + 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/frame/support/procedural/src/pallet/expand/doc_only.rs b/frame/support/procedural/src/pallet/expand/doc_only.rs index 4c107d5548eb5..70f2dca69bc98 100644 --- a/frame/support/procedural/src/pallet/expand/doc_only.rs +++ b/frame/support/procedural/src/pallet/expand/doc_only.rs @@ -24,6 +24,7 @@ pub fn expand_doc_only(def: &mut Def) -> proc_macro2::TokenStream { let storage_viss = &def.storages.iter().map(|storage| &storage.vis).collect::>(); let dispatchables = { if let Some(call_def) = &def.call { + let type_impl_generics = def.type_impl_generics(Span::call_site()); call_def .methods .iter() @@ -38,7 +39,7 @@ pub fn expand_doc_only(def: &mut Def) -> proc_macro2::TokenStream { quote::quote!( #( #[doc = #docs] )* - pub fn #name(#args) { unreachable!(); } + pub fn #name<#type_impl_generics>(#args) { unreachable!(); } ) }) .collect::() @@ -47,9 +48,8 @@ pub fn expand_doc_only(def: &mut Def) -> proc_macro2::TokenStream { } }; - let type_impl_generics = def.type_impl_generics(Span::call_site()); - quote::quote!( + /// Auto-generated docs-only module listing all defined storage types for this pallet #[cfg(doc)] pub mod storage_types { use super::*; @@ -57,13 +57,12 @@ pub fn expand_doc_only(def: &mut Def) -> proc_macro2::TokenStream { #storage_viss use super::#storage_names; )* } + + /// Auto-generated docs-only module listing all defined dispatchables for this pallet #[cfg(doc)] pub mod dispatchables { use super::*; - pub struct Dispatchables; - impl<#type_impl_generics> Dispatchables { - #dispatchables - } + #dispatchables } ) } diff --git a/frame/support/test/pallet/src/lib.rs b/frame/support/test/pallet/src/lib.rs index 82f12ea954614..33563041be9ce 100644 --- a/frame/support/test/pallet/src/lib.rs +++ b/frame/support/test/pallet/src/lib.rs @@ -23,6 +23,7 @@ pub use pallet::*; #[frame_support::pallet] +#[allow(missing_docs)] pub mod pallet { #[allow(unused_imports)] use frame_support::pallet_prelude::*;