diff --git a/sylvia-derive/src/contract/communication/struct_msg.rs b/sylvia-derive/src/contract/communication/struct_msg.rs index d28834cd..b8122b02 100644 --- a/sylvia-derive/src/contract/communication/struct_msg.rs +++ b/sylvia-derive/src/contract/communication/struct_msg.rs @@ -96,20 +96,24 @@ impl<'a> StructMessage<'a> { let bracketed_unused_generics = emit_bracketed_generics(unused_generics); let ret_type = variant + .msg_attr() .msg_type() .emit_result_type(&custom.msg_or_default(), &error.error); - let name = variant.msg_type().emit_msg_name(); + let name = variant.msg_attr().msg_type().emit_msg_name(); let function_name = variant.function_name(); - let mut msg_name = variant.msg_type().emit_msg_name(); + let mut msg_name = variant.msg_attr().msg_type().emit_msg_name(); msg_name.set_span(function_name.span()); - let ctx_type = variant.msg_type().emit_ctx_type(&custom.query_or_default()); + let ctx_type = variant + .msg_attr() + .msg_type() + .emit_ctx_type(&custom.query_or_default()); let fields_names: Vec<_> = variant.fields().iter().map(MsgField::name).collect(); let parameters = variant.fields().iter().map(MsgField::emit_method_field); let fields = variant.fields().iter().map(MsgField::emit_pub); let msg_attrs_to_forward = msg_attrs_to_forward.iter().map(|attr| &attr.attrs); - let derive_call = variant.msg_type().emit_derive_call(); + let derive_call = variant.msg_attr().msg_type().emit_derive_call(); quote! { #[allow(clippy::derive_partial_eq_without_eq)] diff --git a/sylvia-derive/src/contract/mt.rs b/sylvia-derive/src/contract/mt.rs index 46161460..3a9ecb19 100644 --- a/sylvia-derive/src/contract/mt.rs +++ b/sylvia-derive/src/contract/mt.rs @@ -659,10 +659,10 @@ impl EmitMethods for MsgVariant<'_> { .map(|field| field.emit_method_field_folded()) .collect(); let arguments = self.as_fields_names(); - let type_name = self.msg_type().as_accessor_name(); + let type_name = self.msg_attr().msg_type().as_accessor_name(); let name = name.to_case(Case::Snake); - match self.msg_type() { + match self.msg_attr().msg_type() { MsgType::Exec => quote! { #[track_caller] fn #name (&self, #(#params,)* ) -> #sylvia ::multitest::ExecProxy::< #error_type, #api :: #type_name, #mt_app, #custom_msg> { @@ -721,10 +721,10 @@ impl EmitMethods for MsgVariant<'_> { .iter() .map(|field| field.emit_method_field_folded()) .collect(); - let type_name = self.msg_type().as_accessor_name(); + let type_name = self.msg_attr().msg_type().as_accessor_name(); let name = name.to_case(Case::Snake); - match self.msg_type() { + match self.msg_attr().msg_type() { MsgType::Exec => quote! { fn #name (&self, #(#params,)* ) -> #sylvia ::multitest::ExecProxy::< #error_type, #api:: #type_name, MtApp, #custom_msg>; }, diff --git a/sylvia-derive/src/interface/mt.rs b/sylvia-derive/src/interface/mt.rs index ad5aaf4a..0fb4f348 100644 --- a/sylvia-derive/src/interface/mt.rs +++ b/sylvia-derive/src/interface/mt.rs @@ -199,10 +199,10 @@ impl EmitMethods for MsgVariant<'_> { .map(|field| field.emit_method_field_folded()) .collect(); let arguments = self.as_fields_names(); - let type_name = self.msg_type().as_accessor_name(); + let type_name = self.msg_attr().msg_type().as_accessor_name(); let name = name.to_case(Case::Snake); - match self.msg_type() { + match self.msg_attr().msg_type() { MsgType::Exec => quote! { #[track_caller] fn #name (&self, #(#params,)* ) -> #sylvia ::multitest::ExecProxy::< #error_type, #api :: #type_name, #mt_app, #custom_msg> { @@ -261,10 +261,10 @@ impl EmitMethods for MsgVariant<'_> { .iter() .map(|field| field.emit_method_field_folded()) .collect(); - let type_name = self.msg_type().as_accessor_name(); + let type_name = self.msg_attr().msg_type().as_accessor_name(); let name = name.to_case(Case::Snake); - match self.msg_type() { + match self.msg_attr().msg_type() { MsgType::Exec => quote! { fn #name (&self, #(#params,)* ) -> #sylvia ::multitest::ExecProxy::< #error_type, #api:: #type_name, MtApp, #custom_msg>; }, diff --git a/sylvia-derive/src/types/msg_variant.rs b/sylvia-derive/src/types/msg_variant.rs index 807f63ba..7edb1a02 100644 --- a/sylvia-derive/src/types/msg_variant.rs +++ b/sylvia-derive/src/types/msg_variant.rs @@ -166,10 +166,6 @@ impl<'a> MsgVariant<'a> { &self.fields } - pub fn msg_type(&self) -> MsgType { - self.msg_attr.msg_type() - } - pub fn msg_attr(&self) -> &MsgAttr { &self.msg_attr }