Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
use a module instead
Browse files Browse the repository at this point in the history
  • Loading branch information
sam0x17 committed Mar 9, 2023
1 parent a04d760 commit 997c404
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
13 changes: 6 additions & 7 deletions frame/support/procedural/src/pallet/expand/doc_only.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Vec<_>>();
let dispatchables = {
if let Some(call_def) = &def.call {
let type_impl_generics = def.type_impl_generics(Span::call_site());
call_def
.methods
.iter()
Expand All @@ -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::<proc_macro2::TokenStream>()
Expand All @@ -47,23 +48,21 @@ 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::*;
#(
#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
}
)
}
1 change: 1 addition & 0 deletions frame/support/test/pallet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
pub use pallet::*;

#[frame_support::pallet]
#[allow(missing_docs)]
pub mod pallet {
#[allow(unused_imports)]
use frame_support::pallet_prelude::*;
Expand Down

0 comments on commit 997c404

Please sign in to comment.