diff --git a/examples/interfaces/generic/src/lib.rs b/examples/interfaces/generic/src/lib.rs index bf0d3d1d..174ad87f 100644 --- a/examples/interfaces/generic/src/lib.rs +++ b/examples/interfaces/generic/src/lib.rs @@ -170,7 +170,7 @@ mod tests { Sudo1T = SvCustomMsg, Sudo2T = SvCustomMsg, Sudo3T = SvCustomMsg, - RetT = SvCustomMsg, + RetT = Empty, Error = (), > as super::sv::InterfaceMessagesApi>::Exec::generic_exec_one( vec![CosmosMsg::Custom(SvCustomMsg {})], @@ -186,7 +186,7 @@ mod tests { Sudo1T = SvCustomMsg, Sudo2T = SvCustomMsg, Sudo3T = SvCustomMsg, - RetT = SvCustomMsg, + RetT = Empty, Error = (), > as super::sv::InterfaceMessagesApi>::Exec::generic_exec_two( vec![CosmosMsg::Custom(SvCustomMsg {})], @@ -203,7 +203,7 @@ mod tests { Sudo1T = SvCustomMsg, Sudo2T = SvCustomMsg, Sudo3T = SvCustomMsg, - RetT = SvCustomMsg, + RetT = Empty, Error = (), > as super::sv::InterfaceMessagesApi>::Sudo::generic_sudo_one( CosmosMsg::Custom(SvCustomMsg {}), @@ -219,7 +219,7 @@ mod tests { Sudo1T = SvCustomMsg, Sudo2T = SvCustomMsg, Sudo3T = SvCustomMsg, - RetT = SvCustomMsg, + RetT = Empty, Error = (), > as super::sv::InterfaceMessagesApi>::Sudo::generic_sudo_two( CosmosMsg::Custom(SvCustomMsg {}), diff --git a/sylvia-derive/src/interface.rs b/sylvia-derive/src/interface.rs index b75bbca3..d2e387b7 100644 --- a/sylvia-derive/src/interface.rs +++ b/sylvia-derive/src/interface.rs @@ -85,7 +85,7 @@ impl<'a> InterfaceInput<'a> { let Self { associated_types, item, - custom, + .. } = self; let messages = self.emit_messages(); let associated_names: Vec<_> = associated_types @@ -102,7 +102,7 @@ impl<'a> InterfaceInput<'a> { let querier = Querier::new(&query_variants, associated_types, &item.ident).emit_querier_trait(); - let interface_messages = Api::new(item, associated_types, custom).emit(); + let interface_messages = Api::new(item, associated_types).emit(); let multitest_helpers = self.emit_multitest_helpers(); diff --git a/sylvia-derive/src/interface/communication/api.rs b/sylvia-derive/src/interface/communication/api.rs index a5a98739..aafb43f2 100644 --- a/sylvia-derive/src/interface/communication/api.rs +++ b/sylvia-derive/src/interface/communication/api.rs @@ -1,6 +1,5 @@ -use crate::crate_module; use crate::parser::variant_descs::AsVariantDescs; -use crate::parser::{Custom, MsgType}; +use crate::parser::MsgType; use crate::types::associated_types::{AssociatedTypes, ItemType}; use crate::types::msg_variant::MsgVariants; use proc_macro2::TokenStream; @@ -9,28 +8,20 @@ use syn::ItemTrait; pub struct Api<'a> { source: &'a ItemTrait, - custom: &'a Custom, associated_types: &'a AssociatedTypes<'a>, } impl<'a> Api<'a> { - pub fn new( - source: &'a ItemTrait, - associated_types: &'a AssociatedTypes<'a>, - custom: &'a Custom, - ) -> Self { + pub fn new(source: &'a ItemTrait, associated_types: &'a AssociatedTypes<'a>) -> Self { Self { source, - custom, associated_types, } } pub fn emit(&self) -> TokenStream { - let sylvia = crate_module(); let Self { source, - custom, associated_types, } = self; @@ -58,20 +49,10 @@ impl<'a> Api<'a> { &source.generics.where_clause, ); - let where_clause = &self.associated_types.as_where_clause(); - let custom_query = custom.query_or_default(); let exec_generics = &exec_variants.used_generics(); let query_generics = &query_variants.used_generics(); let sudo_generics = &sudo_variants.used_generics(); - let phantom = if !generics.is_empty() { - quote! { - _phantom: std::marker::PhantomData<( #(#generics,)* )>, - } - } else { - quote! {} - }; - quote! { pub trait InterfaceMessagesApi { type Exec; diff --git a/sylvia-derive/src/interface/communication/executor.rs b/sylvia-derive/src/interface/communication/executor.rs index 42190288..b4e35c7e 100644 --- a/sylvia-derive/src/interface/communication/executor.rs +++ b/sylvia-derive/src/interface/communication/executor.rs @@ -9,7 +9,7 @@ use crate::parser::check_generics::GetPath; use crate::types::associated_types::{AssociatedTypes, ItemType}; use crate::types::msg_field::MsgField; use crate::types::msg_variant::{MsgVariant, MsgVariants}; -use crate::utils::{emit_bracketed_generics, SvCasing}; +use crate::utils::SvCasing; pub struct Executor<'a, Generic> { variants: &'a MsgVariants<'a, Generic>, @@ -46,14 +46,11 @@ where .map(ItemType::as_name) .collect(); let all_generics: Vec<_> = associated_types.all_names().collect(); - let assoc_types: Vec<_> = generics - .iter() - .map(|assoc| quote! {Self:: #assoc}) - .collect(); - let bracketed_generics = emit_bracketed_generics(&assoc_types); let accessor = MsgType::Exec.as_accessor_name(); - let executor_api_path = quote! { < dyn #interface_name < Error = (), #(#generics = Self:: #generics,)* > as InterfaceMessagesApi >:: #accessor }; + let executor_api_path = quote! { + < dyn #interface_name < Error = (), #(#generics = Self:: #generics,)* > as InterfaceMessagesApi >:: #accessor + }; let methods_trait_impl = variants .variants() diff --git a/sylvia-derive/src/interface/communication/querier.rs b/sylvia-derive/src/interface/communication/querier.rs index 5f348fe5..0f80f6cc 100644 --- a/sylvia-derive/src/interface/communication/querier.rs +++ b/sylvia-derive/src/interface/communication/querier.rs @@ -9,7 +9,7 @@ use crate::parser::check_generics::GetPath; use crate::types::associated_types::{AssociatedTypes, ItemType}; use crate::types::msg_field::MsgField; use crate::types::msg_variant::{MsgVariant, MsgVariants}; -use crate::utils::{emit_bracketed_generics, SvCasing}; +use crate::utils::SvCasing; pub struct Querier<'a, Generic> { variants: &'a MsgVariants<'a, Generic>, @@ -46,13 +46,10 @@ where .map(ItemType::as_name) .collect(); let all_generics: Vec<_> = associated_types.all_names().collect(); - let assoc_types: Vec<_> = generics - .iter() - .map(|assoc| quote! {Self:: #assoc}) - .collect(); - let bracketed_generics = emit_bracketed_generics(&assoc_types); let accessor = MsgType::Query.as_accessor_name(); - let api_path = quote! { < dyn #interface_name < Error = (), #(#generics = Self:: #generics,)* > as InterfaceMessagesApi > :: #accessor }; + let api_path = quote! { + < dyn #interface_name < Error = (), #(#generics = Self:: #generics,)* > as InterfaceMessagesApi > :: #accessor + }; let methods_trait_impl = variants .variants() diff --git a/sylvia-derive/src/interface/mt.rs b/sylvia-derive/src/interface/mt.rs index 31563ed8..84ae8b83 100644 --- a/sylvia-derive/src/interface/mt.rs +++ b/sylvia-derive/src/interface/mt.rs @@ -8,7 +8,7 @@ use crate::parser::attributes::msg::MsgType; use crate::parser::variant_descs::AsVariantDescs; use crate::types::associated_types::AssociatedTypes; use crate::types::msg_variant::{MsgVariant, MsgVariants}; -use crate::utils::{emit_bracketed_generics, SvCasing}; +use crate::utils::SvCasing; pub struct MtHelpers<'a> { source: &'a ItemTrait, @@ -88,16 +88,9 @@ impl<'a> MtHelpers<'a> { .map(|associated| &associated.ident) .collect(); - let associated_args_for_api: Vec<_> = associated_types - .without_error() - .map(|associated| { - let assoc = &associated.ident; - quote! { Self:: #assoc } - }) - .collect(); - - let bracketed_generics = emit_bracketed_generics(&associated_args_for_api); - let api = quote! { < dyn #interface_name < Error = (), #(#associated_args = Self:: #associated_args,)* > as InterfaceMessagesApi > }; + let api = quote! { + < dyn #interface_name < Error = (), #(#associated_args = Self:: #associated_args,)* > as InterfaceMessagesApi > + }; let associated_types_declaration = associated_types.without_error();