mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 20:11:09 +00:00
frame/support: Link call documentation only in prod-modes (#14283)
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
@@ -16,7 +16,10 @@
|
||||
// limitations under the License.
|
||||
|
||||
use crate::{
|
||||
pallet::{parse::call::CallWeightDef, Def},
|
||||
pallet::{
|
||||
parse::call::{CallVariantDef, CallWeightDef},
|
||||
Def,
|
||||
},
|
||||
COUNTER,
|
||||
};
|
||||
use proc_macro2::TokenStream as TokenStream2;
|
||||
@@ -113,13 +116,22 @@ pub fn expand_call(def: &mut Def) -> proc_macro2::TokenStream {
|
||||
}
|
||||
debug_assert_eq!(fn_weight.len(), methods.len());
|
||||
|
||||
let fn_doc = methods
|
||||
.iter()
|
||||
.map(|method| {
|
||||
let map_fn_docs = if !def.dev_mode {
|
||||
// Emit the [`Pallet::method`] documentation only for non-dev modes.
|
||||
|method: &CallVariantDef| {
|
||||
let reference = format!("See [`Pallet::{}`].", method.name);
|
||||
quote!(#reference)
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
}
|
||||
} else {
|
||||
// For the dev-mode do not provide a documenation link as it will break the
|
||||
// `cargo doc` if the pallet is private inside a test.
|
||||
|method: &CallVariantDef| {
|
||||
let reference = format!("See `Pallet::{}`.", method.name);
|
||||
quote!(#reference)
|
||||
}
|
||||
};
|
||||
|
||||
let fn_doc = methods.iter().map(map_fn_docs).collect::<Vec<_>>();
|
||||
|
||||
let args_name = methods
|
||||
.iter()
|
||||
|
||||
Reference in New Issue
Block a user