From 5b66126a12ffece360cbe5e9206bdfb742ad9ee2 Mon Sep 17 00:00:00 2001 From: Trubnikov Sergey Date: Tue, 29 Nov 2022 13:41:52 +0000 Subject: [PATCH] fix: generate stubs build ans remove warnings --- --- a/crates/evm-coder/procedural/src/abi_derive.rs +++ b/crates/evm-coder/procedural/src/abi_derive.rs @@ -1,4 +1,3 @@ -use proc_macro2::TokenStream; use quote::quote; pub(crate) fn impl_abi_macro(ast: &syn::DeriveInput) -> syn::Result { @@ -128,7 +127,7 @@ } } -fn extract_docs(attrs: &Vec) -> syn::Result> { +fn extract_docs(attrs: &[syn::Attribute]) -> syn::Result> { attrs .iter() .filter_map(|attr| { @@ -163,7 +162,7 @@ } } -fn map_field_to_type<'a>(field: &'a syn::Field) -> &'a syn::Type { +fn map_field_to_type(field: &syn::Field) -> &syn::Type { &field.ty } @@ -177,7 +176,7 @@ } } -fn impl_abi_type<'a>( +fn impl_abi_type( name: &syn::Ident, tuple_type: proc_macro2::TokenStream, ) -> proc_macro2::TokenStream { @@ -194,7 +193,7 @@ } } -fn impl_abi_read<'a>( +fn impl_abi_read( name: &syn::Ident, tuple_type: proc_macro2::TokenStream, tuple_names: proc_macro2::TokenStream, @@ -210,9 +209,9 @@ ) } -fn impl_abi_write<'a>( +fn impl_abi_write( name: &syn::Ident, - is_named_fields: bool, + _is_named_fields: bool, tuple_type: proc_macro2::TokenStream, tuple_data: proc_macro2::TokenStream, ) -> proc_macro2::TokenStream { @@ -301,7 +300,7 @@ field_names: impl Iterator + Clone, field_types: impl Iterator + Clone, field_docs: impl Iterator>> + Clone, - docs: &Vec, + docs: &[String], ) -> syn::Result { let string_name = name.to_string(); let name_type = field_names --- a/crates/evm-coder/src/abi/impls.rs +++ b/crates/evm-coder/src/abi/impls.rs @@ -165,7 +165,7 @@ } impl AbiWrite for Property { - fn abi_write<'a>(&'a self, writer: &mut AbiWriter) { + fn abi_write(&self, writer: &mut AbiWriter) { (&self.key, &self.value).abi_write(writer); } } --- a/crates/evm-coder/src/lib.rs +++ b/crates/evm-coder/src/lib.rs @@ -146,7 +146,7 @@ #[cfg(feature = "std")] pub type string = ::std::string::String; - #[derive(Default, Debug, PartialEq, Clone)] + #[derive(Default, Debug, PartialEq, Eq, Clone)] pub struct bytes(pub Vec); /// Solidity doesn't have `void` type, however we have special implementation --- a/crates/evm-coder/src/solidity/impls.rs +++ b/crates/evm-coder/src/solidity/impls.rs @@ -132,13 +132,14 @@ impl_tuples! {A B C D E F G H I} impl_tuples! {A B C D E F G H I J} -impl sealed::CanBePlacedInVec for Property {} impl StructCollect for Property { fn name() -> String { "Property".into() } fn declaration() -> String { + use std::fmt::Write; + let mut str = String::new(); writeln!(str, "/// @dev Property struct").unwrap(); writeln!(str, "struct {} {{", Self::name()).unwrap(); @@ -167,7 +168,7 @@ } } -impl SolidityTupleType for Property { +impl SolidityType for Property { fn names(tc: &TypeCollector) -> Vec { let mut collected = Vec::with_capacity(Self::len()); { -- gitstuff