Unverified Commit 45ef4132 authored by Robin Freyler's avatar Robin Freyler Committed by GitHub
Browse files

Cleanup metadata codegen slightly (#903)

parent fdae16d7
Pipeline #155328 failed with stages
in 7 minutes and 39 seconds
...@@ -68,7 +68,9 @@ impl Metadata<'_> { ...@@ -68,7 +68,9 @@ impl Metadata<'_> {
let contract_ident = self.contract.module().storage().ident(); let contract_ident = self.contract.module().storage().ident();
quote! { quote! {
<#contract_ident as ::ink_storage::traits::StorageLayout>::layout( <#contract_ident as ::ink_storage::traits::StorageLayout>::layout(
&mut ::ink_primitives::KeyPtr::from(::ink_primitives::Key::from([0x00; 32])) &mut <::ink_primitives::KeyPtr as ::core::convert::From<::ink_primitives::Key>>::from(
<::ink_primitives::Key as ::core::convert::From<[::core::primitive::u8; 32]>>::from([0x00_u8; 32])
)
) )
} }
} }
...@@ -81,16 +83,16 @@ impl Metadata<'_> { ...@@ -81,16 +83,16 @@ impl Metadata<'_> {
quote! { quote! {
::ink_metadata::ContractSpec::new() ::ink_metadata::ContractSpec::new()
.constructors(vec![ .constructors([
#(#constructors ,)* #(#constructors ,)*
]) ])
.messages(vec![ .messages([
#(#messages ,)* #(#messages ,)*
]) ])
.events(vec![ .events([
#(#events ,)* #(#events ,)*
]) ])
.docs(vec![ .docs([
#(#docs ,)* #(#docs ,)*
]) ])
.done() .done()
...@@ -156,10 +158,10 @@ impl Metadata<'_> { ...@@ -156,10 +158,10 @@ impl Metadata<'_> {
quote_spanned!(span => quote_spanned!(span =>
::ink_metadata::ConstructorSpec::#constr ::ink_metadata::ConstructorSpec::#constr
.selector([#(#selector_bytes),*]) .selector([#(#selector_bytes),*])
.args(vec![ .args([
#(#args ,)* #(#args ,)*
]) ])
.docs(vec![ .docs([
#(#docs ,)* #(#docs ,)*
]) ])
.done() .done()
...@@ -202,7 +204,8 @@ impl Metadata<'_> { ...@@ -202,7 +204,8 @@ impl Metadata<'_> {
.collect::<Vec<_>>(); .collect::<Vec<_>>();
quote! { quote! {
::ink_metadata::TypeSpec::with_name_segs::<#ty, _>( ::ink_metadata::TypeSpec::with_name_segs::<#ty, _>(
vec![#(#segs),*].into_iter().map(AsRef::as_ref) ::core::iter::IntoIterator::into_iter([#(#segs),*])
.map(::core::convert::AsRef::as_ref)
) )
} }
} else { } else {
...@@ -250,13 +253,13 @@ impl Metadata<'_> { ...@@ -250,13 +253,13 @@ impl Metadata<'_> {
quote_spanned!(span => quote_spanned!(span =>
::ink_metadata::MessageSpec::#constr ::ink_metadata::MessageSpec::#constr
.selector([#(#selector_bytes),*]) .selector([#(#selector_bytes),*])
.args(vec![ .args([
#(#args ,)* #(#args ,)*
]) ])
.returns(#ret_ty) .returns(#ret_ty)
.mutates(#mutates) .mutates(#mutates)
.payable(#is_payable) .payable(#is_payable)
.docs(vec![ .docs([
#(#docs ,)* #(#docs ,)*
]) ])
.done() .done()
...@@ -291,10 +294,10 @@ impl Metadata<'_> { ...@@ -291,10 +294,10 @@ impl Metadata<'_> {
let args = Self::generate_event_args(event); let args = Self::generate_event_args(event);
quote_spanned!(span => quote_spanned!(span =>
::ink_metadata::EventSpec::new(#ident_lit) ::ink_metadata::EventSpec::new(#ident_lit)
.args(vec![ .args([
#( #args, )* #( #args, )*
]) ])
.docs(vec![ .docs([
#( #docs, )* #( #docs, )*
]) ])
.done() .done()
...@@ -316,7 +319,7 @@ impl Metadata<'_> { ...@@ -316,7 +319,7 @@ impl Metadata<'_> {
::ink_metadata::EventParamSpec::new(#ident_lit) ::ink_metadata::EventParamSpec::new(#ident_lit)
.of_type(#ty) .of_type(#ty)
.indexed(#is_topic) .indexed(#is_topic)
.docs(vec![ .docs([
#( #docs, )* #( #docs, )*
]) ])
.done() .done()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment