mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 08:47:57 +00:00
sp-api: Put frame-metadata behind some feature (#14398)
* sp-api: Put `frame-metadata` behind some feature Closes: https://github.com/paritytech/substrate/issues/14296 * ".git/.scripts/commands/fmt/fmt.sh" * Review feedback --------- Co-authored-by: command-bot <>
This commit is contained in:
@@ -22,7 +22,7 @@ use syn::{
|
||||
ImplItem, ItemImpl, Pat, Path, PathArguments, Result, ReturnType, Signature, Type, TypePath,
|
||||
};
|
||||
|
||||
use quote::{format_ident, quote, ToTokens};
|
||||
use quote::{format_ident, quote};
|
||||
|
||||
use proc_macro_crate::{crate_name, FoundCrate};
|
||||
|
||||
@@ -259,7 +259,10 @@ pub fn versioned_trait_name(trait_ident: &Ident, version: u64) -> Ident {
|
||||
}
|
||||
|
||||
/// Extract the documentation from the provided attributes.
|
||||
#[cfg(feature = "frame-metadata")]
|
||||
pub fn get_doc_literals(attrs: &[syn::Attribute]) -> Vec<syn::Lit> {
|
||||
use quote::ToTokens;
|
||||
|
||||
attrs
|
||||
.iter()
|
||||
.filter_map(|attr| {
|
||||
@@ -275,6 +278,7 @@ pub fn get_doc_literals(attrs: &[syn::Attribute]) -> Vec<syn::Lit> {
|
||||
}
|
||||
|
||||
/// Filters all attributes except the cfg ones.
|
||||
#[cfg(feature = "frame-metadata")]
|
||||
pub fn filter_cfg_attributes(attrs: &[syn::Attribute]) -> Vec<syn::Attribute> {
|
||||
attrs.iter().filter(|a| a.path().is_ident("cfg")).cloned().collect()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user