From 991b3fe813e73acf8c5a46aaa3ae598347709208 Mon Sep 17 00:00:00 2001 From: mihaicalinluca Date: Fri, 13 Oct 2023 12:02:06 +0200 Subject: [PATCH] fmt --- framework/base/src/abi/endpoint_abi.rs | 2 +- framework/base/src/macros.rs | 5 ----- framework/derive/src/model/argument.rs | 2 +- framework/derive/src/model/endpoint.rs | 6 +++--- .../derive/src/parse/attributes/attr_names.rs | 2 +- framework/derive/src/parse/method_parse.rs | 15 ++++++++------- framework/meta/src/abi_json/endpoint_abi_json.rs | 8 ++++++-- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/framework/base/src/abi/endpoint_abi.rs b/framework/base/src/abi/endpoint_abi.rs index 35ee8effd8..4c4e71e3c7 100644 --- a/framework/base/src/abi/endpoint_abi.rs +++ b/framework/base/src/abi/endpoint_abi.rs @@ -47,7 +47,7 @@ pub struct EndpointAbi { pub payable_in_tokens: &'static [&'static str], pub inputs: Vec, pub outputs: OutputAbis, - pub allow_multiple_var_args: bool + pub allow_multiple_var_args: bool, } impl EndpointAbi { diff --git a/framework/base/src/macros.rs b/framework/base/src/macros.rs index 107527c58f..159b639195 100644 --- a/framework/base/src/macros.rs +++ b/framework/base/src/macros.rs @@ -202,11 +202,6 @@ macro_rules! only_owner { }; } -#[macro_export] -macro_rules! allow_multiple_var_args { - () => {}; -} - /// Converts usize to NonZeroUsize or returns SCError. #[macro_export] macro_rules! non_zero_usize { diff --git a/framework/derive/src/model/argument.rs b/framework/derive/src/model/argument.rs index f87cac3b4e..79d45322a6 100644 --- a/framework/derive/src/model/argument.rs +++ b/framework/derive/src/model/argument.rs @@ -59,5 +59,5 @@ pub struct TraitProperties { pub only_owner: bool, pub only_admin: bool, pub only_user_account: bool, - pub allow_multiple_var_args: bool + pub allow_multiple_var_args: bool, } diff --git a/framework/derive/src/model/endpoint.rs b/framework/derive/src/model/endpoint.rs index c8f6c15878..5c3d403fdc 100644 --- a/framework/derive/src/model/endpoint.rs +++ b/framework/derive/src/model/endpoint.rs @@ -3,7 +3,7 @@ use super::{EndpointMutabilityMetadata, MethodPayableMetadata}; #[derive(Clone, Debug)] pub struct InitMetadata { pub payable: MethodPayableMetadata, - pub allow_multiple_var_args: bool + pub allow_multiple_var_args: bool, } #[derive(Clone, Debug)] @@ -14,13 +14,13 @@ pub struct EndpointMetadata { pub only_admin: bool, pub only_user_account: bool, pub mutability: EndpointMutabilityMetadata, - pub allow_multiple_var_args: bool + pub allow_multiple_var_args: bool, } #[derive(Clone, Debug)] pub struct CallbackMetadata { pub callback_name: syn::Ident, - pub allow_multiple_var_args: bool + pub allow_multiple_var_args: bool, } /// Method visibility from the point of view of the smart contract diff --git a/framework/derive/src/parse/attributes/attr_names.rs b/framework/derive/src/parse/attributes/attr_names.rs index 184b170aea..0b9bcf9c3c 100644 --- a/framework/derive/src/parse/attributes/attr_names.rs +++ b/framework/derive/src/parse/attributes/attr_names.rs @@ -25,4 +25,4 @@ pub(super) static ATTR_STORAGE_IS_EMPTY: &str = "storage_is_empty"; pub(super) static ATTR_STORAGE_CLEAR: &str = "storage_clear"; pub(super) static ATTR_PROXY: &str = "proxy"; pub(super) static ATTR_LABEL: &str = "label"; -pub(super) static ATTR_ALLOW_MULTIPLE_VAR_ARGS: &str = "allow_multiple_var_args"; \ No newline at end of file +pub(super) static ATTR_ALLOW_MULTIPLE_VAR_ARGS: &str = "allow_multiple_var_args"; diff --git a/framework/derive/src/parse/method_parse.rs b/framework/derive/src/parse/method_parse.rs index f20c7ce7f4..62eeed2470 100644 --- a/framework/derive/src/parse/method_parse.rs +++ b/framework/derive/src/parse/method_parse.rs @@ -7,11 +7,12 @@ use super::{ process_storage_get_attribute, process_storage_is_empty_attribute, process_storage_mapper_attribute, process_storage_set_attribute, }, - extract_method_args, process_callback_attribute, process_callback_raw_attribute, - process_endpoint_attribute, process_external_view_attribute, process_init_attribute, - process_label_names_attribute, process_only_admin_attribute, process_only_owner_attribute, - process_only_user_account_attribute, process_output_names_attribute, process_payable_attribute, - process_promises_callback_attribute, process_view_attribute, process_allow_multiple_var_args_attribute + extract_method_args, process_allow_multiple_var_args_attribute, process_callback_attribute, + process_callback_raw_attribute, process_endpoint_attribute, process_external_view_attribute, + process_init_attribute, process_label_names_attribute, process_only_admin_attribute, + process_only_owner_attribute, process_only_user_account_attribute, + process_output_names_attribute, process_payable_attribute, process_promises_callback_attribute, + process_view_attribute, }; pub struct MethodAttributesPass1 { pub method_name: String, @@ -19,7 +20,7 @@ pub struct MethodAttributesPass1 { pub only_owner: bool, pub only_admin: bool, pub only_user_account: bool, - pub allow_multiple_var_args: bool + pub allow_multiple_var_args: bool, } pub fn process_method(m: &syn::TraitItemMethod, trait_attributes: &TraitProperties) -> Method { @@ -37,7 +38,7 @@ pub fn process_method(m: &syn::TraitItemMethod, trait_attributes: &TraitProperti only_owner: trait_attributes.only_owner, only_admin: trait_attributes.only_admin, only_user_account: trait_attributes.only_user_account, - allow_multiple_var_args: trait_attributes.allow_multiple_var_args + allow_multiple_var_args: trait_attributes.allow_multiple_var_args, }; let mut first_pass_unprocessed_attributes = Vec::new(); diff --git a/framework/meta/src/abi_json/endpoint_abi_json.rs b/framework/meta/src/abi_json/endpoint_abi_json.rs index 012293ce56..41a0addd77 100644 --- a/framework/meta/src/abi_json/endpoint_abi_json.rs +++ b/framework/meta/src/abi_json/endpoint_abi_json.rs @@ -99,7 +99,7 @@ pub struct EndpointAbiJson { #[serde(skip_serializing_if = "Vec::is_empty")] pub labels: Vec, #[serde(skip_serializing_if = "Option::is_none")] - pub allow_multiple_var_args: Option + pub allow_multiple_var_args: Option, } impl From<&EndpointAbi> for EndpointAbiJson { @@ -122,7 +122,11 @@ impl From<&EndpointAbi> for EndpointAbiJson { inputs: abi.inputs.iter().map(InputAbiJson::from).collect(), outputs: abi.outputs.iter().map(OutputAbiJson::from).collect(), labels: abi.labels.iter().map(|&label| label.to_owned()).collect(), - allow_multiple_var_args: if abi.allow_multiple_var_args { Some(true) } else { None } + allow_multiple_var_args: if abi.allow_multiple_var_args { + Some(true) + } else { + None + }, } } }