mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 09:21:05 +00:00
Improve overall performance (#6699)
* Improve overall performance * Clean up code Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Remove needless :: Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Remove needless :: Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
@@ -249,7 +249,7 @@ impl StorageLineDefExt {
|
||||
StorageLineTypeDef::DoubleMap(map) => map.value.clone(),
|
||||
};
|
||||
let is_option = ext::extract_type_option(&query_type).is_some();
|
||||
let value_type = ext::extract_type_option(&query_type).unwrap_or(query_type.clone());
|
||||
let value_type = ext::extract_type_option(&query_type).unwrap_or_else(|| query_type.clone());
|
||||
|
||||
let module_runtime_generic = &def.module_runtime_generic;
|
||||
let module_runtime_trait = &def.module_runtime_trait;
|
||||
@@ -328,7 +328,7 @@ impl StorageLineDefExt {
|
||||
|
||||
pub enum StorageLineTypeDef {
|
||||
Map(MapDef),
|
||||
DoubleMap(DoubleMapDef),
|
||||
DoubleMap(Box<DoubleMapDef>),
|
||||
Simple(syn::Type),
|
||||
}
|
||||
|
||||
|
||||
@@ -198,7 +198,7 @@ impl_parse_for_opt!(DeclStorageBuild => keyword::build);
|
||||
#[derive(ToTokens, Debug)]
|
||||
enum DeclStorageType {
|
||||
Map(DeclStorageMap),
|
||||
DoubleMap(DeclStorageDoubleMap),
|
||||
DoubleMap(Box<DeclStorageDoubleMap>),
|
||||
Simple(syn::Type),
|
||||
}
|
||||
|
||||
@@ -478,13 +478,13 @@ fn parse_storage_line_defs(
|
||||
}
|
||||
),
|
||||
DeclStorageType::DoubleMap(map) => super::StorageLineTypeDef::DoubleMap(
|
||||
super::DoubleMapDef {
|
||||
Box::new(super::DoubleMapDef {
|
||||
hasher1: map.hasher1.inner.ok_or_else(no_hasher_error)?.into(),
|
||||
hasher2: map.hasher2.inner.ok_or_else(no_hasher_error)?.into(),
|
||||
key1: map.key1,
|
||||
key2: map.key2,
|
||||
value: map.value,
|
||||
}
|
||||
})
|
||||
),
|
||||
DeclStorageType::Simple(expr) => super::StorageLineTypeDef::Simple(expr),
|
||||
};
|
||||
|
||||
@@ -30,7 +30,7 @@ pub(crate) fn fields_idents(
|
||||
fields: impl Iterator<Item = syn::Field>,
|
||||
) -> impl Iterator<Item = proc_macro2::TokenStream> {
|
||||
fields.enumerate().map(|(ix, field)| {
|
||||
field.ident.clone().map(|i| quote!{#i}).unwrap_or_else(|| {
|
||||
field.ident.map(|i| quote!{#i}).unwrap_or_else(|| {
|
||||
let f_ix: syn::Ident = syn::Ident::new(&format!("f_{}", ix), Span::call_site());
|
||||
quote!( #f_ix )
|
||||
})
|
||||
@@ -41,7 +41,7 @@ pub(crate) fn fields_access(
|
||||
fields: impl Iterator<Item = syn::Field>,
|
||||
) -> impl Iterator<Item = proc_macro2::TokenStream> {
|
||||
fields.enumerate().map(|(ix, field)| {
|
||||
field.ident.clone().map(|i| quote!( #i )).unwrap_or_else(|| {
|
||||
field.ident.map(|i| quote!( #i )).unwrap_or_else(|| {
|
||||
let f_ix: syn::Index = syn::Index {
|
||||
index: ix as u32,
|
||||
span: Span::call_site(),
|
||||
|
||||
Reference in New Issue
Block a user