Skip to content

Commit

Permalink
fix styling issues
Browse files Browse the repository at this point in the history
  • Loading branch information
kpob committed Nov 22, 2023
1 parent 2eadabd commit 1377225
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 34 deletions.
6 changes: 5 additions & 1 deletion examples2/src/counter_pack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,11 @@ mod __counter_pack_wasm_parts {
}

pub fn execute_call() {
odra::odra_casper_wasm_env::host_functions::install_contract(entry_points(), Schemas::new(), None);
odra::odra_casper_wasm_env::host_functions::install_contract(
entry_points(),
Schemas::new(),
None
);
}

pub fn execute_get_count() {
Expand Down
16 changes: 8 additions & 8 deletions odra-macros/src/ast/deployer_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ struct DeployStructItem {
semi_token: syn::token::Semi
}

impl<'a> TryFrom<&'a ModuleIR> for DeployStructItem {
impl TryFrom<&'_ ModuleIR> for DeployStructItem {
type Error = syn::Error;

fn try_from(module: &'a ModuleIR) -> Result<Self, Self::Error> {
fn try_from(module: &'_ ModuleIR) -> Result<Self, Self::Error> {
Ok(Self {
vis: utils::syn::visibility_pub(),
struct_token: Default::default(),
Expand All @@ -35,10 +35,10 @@ struct DeployImplItem {
init_fn: ContractInitFn
}

impl<'a> TryFrom<&'a ModuleIR> for DeployImplItem {
impl TryFrom<&'_ ModuleIR> for DeployImplItem {
type Error = syn::Error;

fn try_from(module: &'a ModuleIR) -> Result<Self, Self::Error> {
fn try_from(module: &'_ ModuleIR) -> Result<Self, Self::Error> {
Ok(Self {
impl_token: Default::default(),
ident: module.deployer_ident()?,
Expand All @@ -62,10 +62,10 @@ struct ContractInitFn {
host_ref_instance: HostRefInstanceExpr
}

impl<'a> TryFrom<&'a ModuleIR> for ContractInitFn {
impl TryFrom<&'_ ModuleIR> for ContractInitFn {
type Error = syn::Error;

fn try_from(module: &'a ModuleIR) -> Result<Self, Self::Error> {
fn try_from(module: &'_ ModuleIR) -> Result<Self, Self::Error> {
Ok(Self {
vis: utils::syn::visibility_pub(),
sig: module.try_into()?,
Expand All @@ -83,10 +83,10 @@ pub struct DeployerItem {
impl_item: DeployImplItem
}

impl<'a> TryFrom<&'a ModuleIR> for DeployerItem {
impl TryFrom<&'_ ModuleIR> for DeployerItem {
type Error = syn::Error;

fn try_from(module: &'a ModuleIR) -> Result<Self, Self::Error> {
fn try_from(module: &'_ ModuleIR) -> Result<Self, Self::Error> {
Ok(Self {
struct_item: module.try_into()?,
impl_item: module.try_into()?
Expand Down
16 changes: 8 additions & 8 deletions odra-macros/src/ast/deployer_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ pub struct DeployerInitSignature {
output: syn::ReturnType
}

impl<'a> TryFrom<&'a ModuleIR> for DeployerInitSignature {
impl TryFrom<&'_ ModuleIR> for DeployerInitSignature {
type Error = syn::Error;

fn try_from(module: &'a ModuleIR) -> Result<Self, Self::Error> {
fn try_from(module: &'_ ModuleIR) -> Result<Self, Self::Error> {
let host_ref_ident = module.host_ref_ident()?;
let ty_host_env = utils::ty::host_env();
let env = utils::ident::env();
Expand All @@ -48,10 +48,10 @@ pub struct EntrypointCallerExpr {
semi_token: syn::token::Semi
}

impl<'a> TryFrom<&'a ModuleIR> for EntrypointCallerExpr {
impl TryFrom<&'_ ModuleIR> for EntrypointCallerExpr {
type Error = syn::Error;

fn try_from(module: &'a ModuleIR) -> Result<Self, Self::Error> {
fn try_from(module: &'_ ModuleIR) -> Result<Self, Self::Error> {
Ok(Self {
let_token: Default::default(),
ident: utils::ident::caller(),
Expand Down Expand Up @@ -95,10 +95,10 @@ pub struct NewContractExpr {
semi_token: syn::token::Semi
}

impl<'a> TryFrom<&'a ModuleIR> for NewContractExpr {
impl TryFrom<&'_ ModuleIR> for NewContractExpr {
type Error = syn::Error;

fn try_from(module: &'a ModuleIR) -> Result<Self, Self::Error> {
fn try_from(module: &'_ ModuleIR) -> Result<Self, Self::Error> {
let module_str = module.module_str()?;
let caller_ident = utils::ident::caller();
let env_ident = utils::ident::env();
Expand Down Expand Up @@ -137,10 +137,10 @@ pub struct HostRefInstanceExpr {
fields: syn::punctuated::Punctuated<syn::FieldValue, syn::Token![,]>
}

impl<'a> TryFrom<&'a ModuleIR> for HostRefInstanceExpr {
impl TryFrom<&'_ ModuleIR> for HostRefInstanceExpr {
type Error = syn::Error;

fn try_from(module: &'a ModuleIR) -> Result<Self, Self::Error> {
fn try_from(module: &'_ ModuleIR) -> Result<Self, Self::Error> {
let address_ident = utils::ident::address();
let env_ident = utils::ident::env();
let attached_value_ident = utils::ident::attached_value();
Expand Down
18 changes: 9 additions & 9 deletions odra-macros/src/ast/host_ref_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct HostRefStructItem {
impl TryFrom<&'_ ModuleIR> for HostRefStructItem {
type Error = syn::Error;

fn try_from(value: &'_ ModuleIR) -> Result<Self, Self::Error> {
fn try_from(module: &'_ ModuleIR) -> Result<Self, Self::Error> {
let vis_pub = utils::syn::visibility_pub();

let address = utils::ident::address();
Expand All @@ -35,7 +35,7 @@ impl TryFrom<&'_ ModuleIR> for HostRefStructItem {
Ok(Self {
vis: vis_pub,
struct_token: Default::default(),
ident: value.host_ref_ident()?,
ident: module.host_ref_ident()?,
fields: named_fields.into()
})
}
Expand All @@ -61,15 +61,15 @@ struct HostRefImplItem {
impl TryFrom<&'_ ModuleIR> for HostRefImplItem {
type Error = syn::Error;

fn try_from(value: &'_ ModuleIR) -> Result<Self, Self::Error> {
fn try_from(module: &'_ ModuleIR) -> Result<Self, Self::Error> {
Ok(Self {
impl_token: Default::default(),
ref_ident: value.host_ref_ident()?,
ref_ident: module.host_ref_ident()?,
brace_token: Default::default(),
with_tokens_fn: WithTokensFnItem,
get_event_fn: GetEventFnItem,
last_call_fn: LastCallFnItem,
functions: value
functions: module
.host_functions()
.iter()
.flat_map(|f| {
Expand Down Expand Up @@ -151,13 +151,13 @@ pub struct HostRefItem {
impl_item: HostRefImplItem
}

impl<'a> TryFrom<&'a ModuleIR> for HostRefItem {
impl TryFrom<&'_ ModuleIR> for HostRefItem {
type Error = syn::Error;

fn try_from(value: &'a ModuleIR) -> Result<Self, Self::Error> {
fn try_from(module: &'_ ModuleIR) -> Result<Self, Self::Error> {
Ok(Self {
struct_item: value.try_into()?,
impl_item: value.try_into()?
struct_item: module.try_into()?,
impl_item: module.try_into()?
})
}
}
Expand Down
16 changes: 8 additions & 8 deletions odra-macros/src/ast/ref_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ struct ContractRefStructItem {
impl TryFrom<&'_ ModuleIR> for ContractRefStructItem {
type Error = syn::Error;

fn try_from(value: &'_ ModuleIR) -> Result<Self, Self::Error> {
fn try_from(module: &'_ ModuleIR) -> Result<Self, Self::Error> {
let address = utils::ident::address();
let env = utils::ident::env();
let ty_address = utils::ty::address();
Expand All @@ -26,7 +26,7 @@ impl TryFrom<&'_ ModuleIR> for ContractRefStructItem {
Ok(Self {
vis: utils::syn::visibility_pub(),
struct_token: Default::default(),
ident: value.contract_ref_ident()?,
ident: module.contract_ref_ident()?,
fields: named_fields.into()
})
}
Expand Down Expand Up @@ -63,13 +63,13 @@ struct ContractRefImplItem {
impl TryFrom<&'_ ModuleIR> for ContractRefImplItem {
type Error = syn::Error;

fn try_from(value: &'_ ModuleIR) -> Result<Self, Self::Error> {
fn try_from(module: &'_ ModuleIR) -> Result<Self, Self::Error> {
Ok(Self {
impl_token: Default::default(),
ref_ident: value.contract_ref_ident()?,
ref_ident: module.contract_ref_ident()?,
brace_token: Default::default(),
address_fn: AddressFnItem,
functions: value
functions: module
.functions()
.iter()
.map(ref_utils::contract_function_item)
Expand All @@ -87,10 +87,10 @@ pub struct RefItem {
impl TryFrom<&'_ ModuleIR> for RefItem {
type Error = syn::Error;

fn try_from(value: &'_ ModuleIR) -> Result<Self, Self::Error> {
fn try_from(module: &'_ ModuleIR) -> Result<Self, Self::Error> {
Ok(Self {
struct_item: value.try_into()?,
impl_item: value.try_into()?
struct_item: module.try_into()?,
impl_item: module.try_into()?
})
}
}
Expand Down

0 comments on commit 1377225

Please sign in to comment.