Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
mihaicalinluca committed Oct 13, 2023
1 parent 658c032 commit 991b3fe
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion framework/base/src/abi/endpoint_abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub struct EndpointAbi {
pub payable_in_tokens: &'static [&'static str],
pub inputs: Vec<InputAbi>,
pub outputs: OutputAbis,
pub allow_multiple_var_args: bool
pub allow_multiple_var_args: bool,
}

impl EndpointAbi {
Expand Down
5 changes: 0 additions & 5 deletions framework/base/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion framework/derive/src/model/argument.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
6 changes: 3 additions & 3 deletions framework/derive/src/model/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion framework/derive/src/parse/attributes/attr_names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
pub(super) static ATTR_ALLOW_MULTIPLE_VAR_ARGS: &str = "allow_multiple_var_args";
15 changes: 8 additions & 7 deletions framework/derive/src/parse/method_parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,20 @@ 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,
pub payable: MethodPayableMetadata,
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 {
Expand All @@ -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();

Expand Down
8 changes: 6 additions & 2 deletions framework/meta/src/abi_json/endpoint_abi_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ pub struct EndpointAbiJson {
#[serde(skip_serializing_if = "Vec::is_empty")]
pub labels: Vec<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub allow_multiple_var_args: Option<bool>
pub allow_multiple_var_args: Option<bool>,
}

impl From<&EndpointAbi> for EndpointAbiJson {
Expand All @@ -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
},
}
}
}

0 comments on commit 991b3fe

Please sign in to comment.