From 6216b2e4a2afb954f00cae08c94cb9195d308a31 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Sun, 10 Oct 2021 10:31:34 +0200 Subject: [PATCH] chore: remove unused && cargo fix (#496) * chore: rm allows * chore: cargo fix --- .../ethers-contract-abigen/src/contract.rs | 9 +- .../src/contract/common.rs | 4 +- .../src/contract/events.rs | 75 +++------------- .../src/contract/methods.rs | 86 +++++++++---------- .../src/contract/structs.rs | 7 +- .../ethers-contract-abigen/src/lib.rs | 2 - .../ethers-contract-abigen/src/rawabi.rs | 2 +- .../ethers-contract-abigen/src/source.rs | 8 +- .../ethers-contract-abigen/src/util.rs | 4 +- ethers-contract/tests/abigen.rs | 4 +- ethers-contract/tests/contract.rs | 6 +- ethers-core/src/types/block.rs | 4 +- ethers-etherscan/src/lib.rs | 2 +- ethers-middleware/tests/signer.rs | 5 +- ethers-middleware/tests/transformer.rs | 1 + ethers-signers/src/aws/mod.rs | 4 +- ethers-signers/src/aws/utils.rs | 6 +- ethers-signers/src/ledger/app.rs | 4 +- ethers-signers/src/ledger/mod.rs | 6 +- ethers-signers/src/ledger/types.rs | 1 + 20 files changed, 90 insertions(+), 150 deletions(-) diff --git a/ethers-contract/ethers-contract-abigen/src/contract.rs b/ethers-contract/ethers-contract-abigen/src/contract.rs index a36aefed..34bc0266 100644 --- a/ethers-contract/ethers-contract-abigen/src/contract.rs +++ b/ethers-contract/ethers-contract-abigen/src/contract.rs @@ -10,16 +10,13 @@ use super::Abigen; use crate::contract::structs::InternalStructs; use crate::rawabi::RawAbi; use anyhow::{anyhow, Context as _, Result}; -use ethers_core::{ - abi::{parse_abi, Abi, AbiParser}, - types::Address, -}; -use inflector::Inflector; +use ethers_core::abi::{Abi, AbiParser}; + use proc_macro2::{Ident, Literal, TokenStream}; use quote::quote; use serde::Deserialize; use std::collections::BTreeMap; -use syn::{Path, Visibility}; +use syn::Path; /// Internal shared context for generating smart contract bindings. pub(crate) struct Context { diff --git a/ethers-contract/ethers-contract-abigen/src/contract/common.rs b/ethers-contract/ethers-contract-abigen/src/contract/common.rs index ae6fc371..11ef39f8 100644 --- a/ethers-contract/ethers-contract-abigen/src/contract/common.rs +++ b/ethers-contract/ethers-contract-abigen/src/contract/common.rs @@ -1,7 +1,6 @@ use super::{util, Context}; -use ethers_core::types::Address; -use proc_macro2::{Literal, TokenStream}; +use proc_macro2::TokenStream; use quote::quote; use super::util::{ethers_contract_crate, ethers_core_crate, ethers_providers_crate}; @@ -16,7 +15,6 @@ pub(crate) fn imports(name: &str) -> TokenStream { quote! { #![allow(clippy::enum_variant_names)] #![allow(dead_code)] - #![allow(clippy::redundant_clone)] #![allow(clippy::type_complexity)] #![allow(unused_imports)] #doc diff --git a/ethers-contract/ethers-contract-abigen/src/contract/events.rs b/ethers-contract/ethers-contract-abigen/src/contract/events.rs index 1d1b6e4c..f976928a 100644 --- a/ethers-contract/ethers-contract-abigen/src/contract/events.rs +++ b/ethers-contract/ethers-contract-abigen/src/contract/events.rs @@ -1,6 +1,6 @@ use super::{types, util, Context}; use anyhow::Result; -use ethers_core::abi::{Event, EventExt, EventParam, Hash, ParamType, SolStruct}; +use ethers_core::abi::{Event, EventExt, EventParam, ParamType, SolStruct}; use inflector::Inflector; use proc_macro2::{Ident, Literal, TokenStream}; use quote::quote; @@ -274,49 +274,6 @@ impl Context { pub #data_type_definition }) } - - /// Expands a event parameter into an event builder filter method for the - /// specified topic index. - fn expand_builder_topic_filter( - &self, - topic_index: usize, - param: &EventParam, - ) -> Result { - let doc = util::expand_doc(&format!( - "Adds a filter for the `{}` event parameter.", - param.name, - )); - let topic = util::ident(&format!("topic{}", topic_index)); - let name = if param.name.is_empty() { - topic.clone() - } else { - util::safe_ident(¶m.name.to_snake_case()) - }; - let ty = self.expand_input_type(param)?; - - Ok(quote! { - #doc - pub fn #name(mut self, topic: Topic<#ty>) -> Self { - self.0 = (self.0).#topic(topic); - self - } - }) - } - - /// Expands an ABI event into filter methods for its indexed parameters. - fn expand_builder_topic_filters(&self, event: &Event) -> Result { - let topic_filters = event - .inputs - .iter() - .filter(|input| input.indexed) - .enumerate() - .map(|(topic_index, input)| self.expand_builder_topic_filter(topic_index, input)) - .collect::>>()?; - - Ok(quote! { - #( #topic_filters )* - }) - } } /// Expands an ABI event into an identifier for its event data type. @@ -363,32 +320,26 @@ fn expand_data_tuple(name: &Ident, params: &[(TokenStream, TokenStream, bool)]) quote! { struct #name( #( #fields ),* ); } } -/// Expands an ABI event into an identifier for its event data type. -fn expand_builder_name(event: &Event) -> TokenStream { - let builder_name = util::ident(&format!("{}Builder", &event.name.to_pascal_case())); - quote! { #builder_name } -} - fn expand_derives(derives: &[Path]) -> TokenStream { quote! {#(#derives),*} } -/// Expands a 256-bit `Hash` into a literal representation that can be used with -/// quasi-quoting for code generation. We do this to avoid allocating at runtime -fn expand_hash(hash: Hash) -> TokenStream { - let bytes = hash.as_bytes().iter().copied().map(Literal::u8_unsuffixed); - let ethers_core = util::ethers_core_crate(); - - quote! { - #ethers_core::types::H256([#( #bytes ),*]) - } -} - #[cfg(test)] mod tests { use super::*; use crate::Abigen; - use ethers_core::abi::{EventParam, ParamType}; + use ethers_core::abi::{EventParam, Hash, ParamType}; + + /// Expands a 256-bit `Hash` into a literal representation that can be used with + /// quasi-quoting for code generation. We do this to avoid allocating at runtime + fn expand_hash(hash: Hash) -> TokenStream { + let bytes = hash.as_bytes().iter().copied().map(Literal::u8_unsuffixed); + let ethers_core = util::ethers_core_crate(); + + quote! { + #ethers_core::types::H256([#( #bytes ),*]) + } + } fn test_context() -> Context { Context::from_abigen(Abigen::new("TestToken", "[]").unwrap()).unwrap() diff --git a/ethers-contract/ethers-contract-abigen/src/contract/methods.rs b/ethers-contract/ethers-contract-abigen/src/contract/methods.rs index fc481eff..f06c4017 100644 --- a/ethers-contract/ethers-contract-abigen/src/contract/methods.rs +++ b/ethers-contract/ethers-contract-abigen/src/contract/methods.rs @@ -1,8 +1,8 @@ use super::{types, util, Context}; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result}; use ethers_core::abi::ParamType; use ethers_core::{ - abi::{Function, FunctionExt, Param, StateMutability}, + abi::{Function, FunctionExt, Param}, types::Selector, }; use inflector::Inflector; @@ -129,47 +129,6 @@ impl Context { } } -// converts the function params to name/type pairs -pub(crate) fn expand_inputs(inputs: &[Param]) -> Result { - let params = inputs - .iter() - .enumerate() - .map(|(i, param)| { - let name = util::expand_input_name(i, ¶m.name); - let kind = types::expand(¶m.kind)?; - Ok(quote! { #name: #kind }) - }) - .collect::>>()?; - Ok(quote! { #( , #params )* }) -} - -// packs the argument in a tuple to be used for the contract call -pub(crate) fn expand_inputs_call_arg(inputs: &[Param]) -> TokenStream { - let names = inputs - .iter() - .enumerate() - .map(|(i, param)| { - let name = util::expand_input_name(i, ¶m.name); - match param.kind { - // this is awkward edge case where the function inputs are a single struct - // we need to force this argument into a tuple so it gets expanded to `((#name,))` - // this is currently necessary because internally `flatten_tokens` is called which removes the outermost `tuple` level - // and since `((#name))` is not a rust tuple it doesn't get wrapped into another tuple that will be peeled off by `flatten_tokens` - ParamType::Tuple(_) if inputs.len() == 1 => { - // make sure the tuple gets converted to `Token::Tuple` - quote! {(#name,)} - } - _ => name, - } - }) - .collect::>(); - match names.len() { - 0 => quote! { () }, - 1 => quote! { #( #names )* }, - _ => quote! { ( #(#names, )* ) }, - } -} - fn expand_fn_outputs(outputs: &[Param]) -> Result { match outputs.len() { 0 => Ok(quote! { () }), @@ -194,6 +153,47 @@ mod tests { use super::*; use ethers_core::abi::ParamType; + // packs the argument in a tuple to be used for the contract call + fn expand_inputs_call_arg(inputs: &[Param]) -> TokenStream { + let names = inputs + .iter() + .enumerate() + .map(|(i, param)| { + let name = util::expand_input_name(i, ¶m.name); + match param.kind { + // this is awkward edge case where the function inputs are a single struct + // we need to force this argument into a tuple so it gets expanded to `((#name,))` + // this is currently necessary because internally `flatten_tokens` is called which removes the outermost `tuple` level + // and since `((#name))` is not a rust tuple it doesn't get wrapped into another tuple that will be peeled off by `flatten_tokens` + ParamType::Tuple(_) if inputs.len() == 1 => { + // make sure the tuple gets converted to `Token::Tuple` + quote! {(#name,)} + } + _ => name, + } + }) + .collect::>(); + match names.len() { + 0 => quote! { () }, + 1 => quote! { #( #names )* }, + _ => quote! { ( #(#names, )* ) }, + } + } + + // converts the function params to name/type pairs + fn expand_inputs(inputs: &[Param]) -> Result { + let params = inputs + .iter() + .enumerate() + .map(|(i, param)| { + let name = util::expand_input_name(i, ¶m.name); + let kind = types::expand(¶m.kind)?; + Ok(quote! { #name: #kind }) + }) + .collect::>>()?; + Ok(quote! { #( , #params )* }) + } + #[test] fn test_expand_inputs_call_arg() { // no inputs diff --git a/ethers-contract/ethers-contract-abigen/src/contract/structs.rs b/ethers-contract/ethers-contract-abigen/src/contract/structs.rs index 88c683b3..7e6273ac 100644 --- a/ethers-contract/ethers-contract-abigen/src/contract/structs.rs +++ b/ethers-contract/ethers-contract-abigen/src/contract/structs.rs @@ -3,7 +3,7 @@ use std::collections::{HashMap, VecDeque}; use anyhow::{Context as _, Result}; use inflector::Inflector; -use proc_macro2::{Literal, TokenStream}; +use proc_macro2::TokenStream; use quote::quote; use ethers_core::abi::{ @@ -15,7 +15,6 @@ use ethers_core::abi::{ use crate::contract::{types, Context}; use crate::rawabi::{Component, RawAbi}; use crate::util; -use std::any::Any; impl Context { /// Generate corresponding types for structs parsed from a human readable ABI @@ -193,9 +192,6 @@ impl Context { /// This is currently used to get access to all the unique solidity structs used as function in/output until `ethabi` supports it as well. #[derive(Debug, Clone, Default)] pub struct InternalStructs { - /// All unique internal types that are function inputs or outputs - pub(crate) top_level_internal_types: HashMap, - /// (function name, param name) -> struct which are the identifying properties we get the name from ethabi. pub(crate) function_params: HashMap<(String, String), String>, @@ -269,7 +265,6 @@ impl InternalStructs { } Self { - top_level_internal_types, function_params, outputs, structs, diff --git a/ethers-contract/ethers-contract-abigen/src/lib.rs b/ethers-contract/ethers-contract-abigen/src/lib.rs index 8cf949e7..58643ccf 100644 --- a/ethers-contract/ethers-contract-abigen/src/lib.rs +++ b/ethers-contract/ethers-contract-abigen/src/lib.rs @@ -1,5 +1,3 @@ -#![allow(dead_code)] -#![allow(unused_imports)] #![deny(missing_docs, unsafe_code)] //! Module for generating type-safe bindings to Ethereum smart contracts. This diff --git a/ethers-contract/ethers-contract-abigen/src/rawabi.rs b/ethers-contract/ethers-contract-abigen/src/rawabi.rs index 3904fd68..6a46f5ed 100644 --- a/ethers-contract/ethers-contract-abigen/src/rawabi.rs +++ b/ethers-contract/ethers-contract-abigen/src/rawabi.rs @@ -2,7 +2,7 @@ #![allow(missing_docs)] use serde::{ - de::{EnumAccess, Error, MapAccess, SeqAccess, Visitor}, + de::{MapAccess, SeqAccess, Visitor}, Deserialize, Deserializer, Serialize, }; diff --git a/ethers-contract/ethers-contract-abigen/src/source.rs b/ethers-contract/ethers-contract-abigen/src/source.rs index 71c08745..50b1e7f2 100644 --- a/ethers-contract/ethers-contract-abigen/src/source.rs +++ b/ethers-contract/ethers-contract-abigen/src/source.rs @@ -113,7 +113,7 @@ impl Source { } /// Creates a local filesystem source from a path string. - fn local

(path: P) -> Self + pub fn local

(path: P) -> Self where P: AsRef, { @@ -121,7 +121,7 @@ impl Source { } /// Creates an HTTP source from a URL. - fn http(url: S) -> Result + pub fn http(url: S) -> Result where S: AsRef, { @@ -129,7 +129,7 @@ impl Source { } /// Creates an Etherscan source from an address string. - fn etherscan(address: S) -> Result + pub fn etherscan(address: S) -> Result where S: AsRef, { @@ -139,7 +139,7 @@ impl Source { } /// Creates an Etherscan source from an address string. - fn npm(package_path: S) -> Self + pub fn npm(package_path: S) -> Self where S: Into, { diff --git a/ethers-contract/ethers-contract-abigen/src/util.rs b/ethers-contract/ethers-contract-abigen/src/util.rs index 14b84b68..87946c41 100644 --- a/ethers-contract/ethers-contract-abigen/src/util.rs +++ b/ethers-contract/ethers-contract-abigen/src/util.rs @@ -1,12 +1,12 @@ use ethers_core::types::Address; use anyhow::{anyhow, Result}; -use cargo_metadata::{CargoOpt, DependencyKind, Metadata, MetadataCommand}; +use cargo_metadata::{DependencyKind, MetadataCommand}; use inflector::Inflector; use once_cell::sync::Lazy; use proc_macro2::{Ident, Literal, Span, TokenStream}; use quote::quote; -use reqwest::Client; + use syn::{Ident as SynIdent, Path}; /// See `determine_ethers_crates` diff --git a/ethers-contract/tests/abigen.rs b/ethers-contract/tests/abigen.rs index d79660aa..1febb0ea 100644 --- a/ethers-contract/tests/abigen.rs +++ b/ethers-contract/tests/abigen.rs @@ -91,6 +91,6 @@ fn can_gen_human_readable_with_structs() { let (client, _mock) = Provider::mocked(); let contract = SimpleContract::new(Address::default(), Arc::new(client)); - let foo = Foo { x: 100u64.into() }; - let _ = contract.foo(foo); + let f = Foo { x: 100u64.into() }; + let _ = contract.foo(f); } diff --git a/ethers-contract/tests/contract.rs b/ethers-contract/tests/contract.rs index cc248413..81e5dd5c 100644 --- a/ethers-contract/tests/contract.rs +++ b/ethers-contract/tests/contract.rs @@ -1,8 +1,8 @@ -use ethers_contract::{abigen, ContractFactory, EthAbiType}; -use ethers_core::types::{Filter, ValueOrArray, H256}; - +#![allow(unused)] mod common; pub use common::*; +use ethers_contract::{abigen, ContractFactory, EthAbiType}; +use ethers_core::types::{Filter, ValueOrArray, H256}; #[cfg(not(feature = "celo"))] mod eth_tests { diff --git a/ethers-core/src/types/block.rs b/ethers-core/src/types/block.rs index fcfd0c3a..13fede2b 100644 --- a/ethers-core/src/types/block.rs +++ b/ethers-core/src/types/block.rs @@ -258,13 +258,13 @@ mod celo_tests { #[test] fn block_without_snark_data() { let block = r#"{"extraData":"0xd983010000846765746889676f312e31332e3130856c696e7578000000000000f8b2c0c080b841cfa11585812ec794c4baa46178690971b3c72e367211d68a9ea318ff500c5aeb7099cafc965240e3b57cf7355341cf76bdca74530334658370d2df7b2e030ab200f582027db017810fa05b4f35927f968f6be1a61e322d4ace3563feb8a489690a91c031fda640c55c216f6712a7bdde994338a5610080f58203ffb093cd643f5154979952791ff714eb885df0f18012f2211fb8c29a8947130dc3adf4ecb48a3c4a142a0faa51e5c60b048180","gasUsed":"0xbef6","hash":"0x37ac2818e50e61f0566caea102ed98677f2552fa86fed53443315ed11fe0eaad","logsBloom":"0x00000800000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000100000000000000000000000000000000000000000000000000000000000000080000000000001020000400000000000000000000000000000000000000000000000000000000000080000000000000000000000000400000000000000000000000000000000000000100000040004000000000000800000000000000000084000000000000000000000000000000000020000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000","miner":"0xcda518f6b5a797c3ec45d37c65b83e0b0748edca","number":"0x1b4","parentHash":"0xa6b4775f600c2981f9142cbc1361db02c7ba8c185a1110537b255356876301a2","randomness":{"committed":"0x049e84c89f1aa0e3a770b2545b05a30eb814dae322e7247fd2bf27e6cacb1f51","revealed":"0x5a8826bf59a7ed1ee86a9d6464fa9c1fcece78ffa7cf32b11a03ad251ddcefe6"},"receiptsRoot":"0x1724dc3e7c2bfa03974c1deedf5ea20ad30b72e25f3c62fbb5fd06fc107068d7","size":"0x3a0","stateRoot":"0xc45fa03e69dccb54b4981d23d77328ab8906ddd7a0d8238b9c54ae1a14df4d1c","timestamp":"0x5e90166d","totalDifficulty":"0x1b5","transactions":[{"blockHash":"0x37ac2818e50e61f0566caea102ed98677f2552fa86fed53443315ed11fe0eaad","blockNumber":"0x1b4","from":"0x456f41406b32c45d59e539e4bba3d7898c3584da","gas":"0x1312d00","gasPrice":"0x174876e800","feeCurrency":null,"gatewayFeeRecipient":null,"gatewayFee":"0x0","hash":"0xf7b1b588b1fc03305f556805812273d80fb61fc0ba7f812de27189e95c5ecfc5","input":"0xed385274000000000000000000000000b9ff7ab50a2f0fd3e2fb2814b016ac90c91df98f03386ba30000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000be951906eba2aa800000","nonce":"0x147","to":"0xa12a699c641cc875a7ca57495861c79c33d293b4","transactionIndex":"0x0","value":"0x0","v":"0x15e08","r":"0x5787d040d09a34cb2b9ffcd096be7fe66aa6a3ed0632f182d1f3045640a9ef8b","s":"0x7897f58740f2a1c645826579106a620c306fc56381520ae2f28880bb284c4abd"}],"transactionsRoot":"0xbc8cb40b809914b9cd735b12e9b1802cf5d85de5223a22bbdb249a7e8b45ec93"}"#; - let block: Block = serde_json::from_str(&block).unwrap(); + let block: Block = serde_json::from_str(block).unwrap(); assert_eq!(block.epoch_snark_data, None); } #[test] fn block_with_snark_data() { let block = r#"{"extraData":"0xd983010000846765746889676f312e31332e3130856c696e7578000000000000f8b2c0c080b841cfa11585812ec794c4baa46178690971b3c72e367211d68a9ea318ff500c5aeb7099cafc965240e3b57cf7355341cf76bdca74530334658370d2df7b2e030ab200f582027db017810fa05b4f35927f968f6be1a61e322d4ace3563feb8a489690a91c031fda640c55c216f6712a7bdde994338a5610080f58203ffb093cd643f5154979952791ff714eb885df0f18012f2211fb8c29a8947130dc3adf4ecb48a3c4a142a0faa51e5c60b048180","gasUsed":"0xbef6","hash":"0x37ac2818e50e61f0566caea102ed98677f2552fa86fed53443315ed11fe0eaad","logsBloom":"0x00000800000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000100000000000000000000000000000000000000000000000000000000000000080000000000001020000400000000000000000000000000000000000000000000000000000000000080000000000000000000000000400000000000000000000000000000000000000100000040004000000000000800000000000000000084000000000000000000000000000000000020000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000","miner":"0xcda518f6b5a797c3ec45d37c65b83e0b0748edca","number":"0x1b4","parentHash":"0xa6b4775f600c2981f9142cbc1361db02c7ba8c185a1110537b255356876301a2","randomness":{"committed":"0x049e84c89f1aa0e3a770b2545b05a30eb814dae322e7247fd2bf27e6cacb1f51","revealed":"0x5a8826bf59a7ed1ee86a9d6464fa9c1fcece78ffa7cf32b11a03ad251ddcefe6"},"receiptsRoot":"0x1724dc3e7c2bfa03974c1deedf5ea20ad30b72e25f3c62fbb5fd06fc107068d7","size":"0x3a0","stateRoot":"0xc45fa03e69dccb54b4981d23d77328ab8906ddd7a0d8238b9c54ae1a14df4d1c","timestamp":"0x5e90166d","totalDifficulty":"0x1b5","transactions":[{"blockHash":"0x37ac2818e50e61f0566caea102ed98677f2552fa86fed53443315ed11fe0eaad","blockNumber":"0x1b4","from":"0x456f41406b32c45d59e539e4bba3d7898c3584da","gas":"0x1312d00","gasPrice":"0x174876e800","feeCurrency":null,"gatewayFeeRecipient":null,"gatewayFee":"0x0","hash":"0xf7b1b588b1fc03305f556805812273d80fb61fc0ba7f812de27189e95c5ecfc5","input":"0xed385274000000000000000000000000b9ff7ab50a2f0fd3e2fb2814b016ac90c91df98f03386ba30000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000be951906eba2aa800000","nonce":"0x147","to":"0xa12a699c641cc875a7ca57495861c79c33d293b4","transactionIndex":"0x0","value":"0x0","v":"0x15e08","r":"0x5787d040d09a34cb2b9ffcd096be7fe66aa6a3ed0632f182d1f3045640a9ef8b","s":"0x7897f58740f2a1c645826579106a620c306fc56381520ae2f28880bb284c4abd"}],"transactionsRoot":"0xbc8cb40b809914b9cd735b12e9b1802cf5d85de5223a22bbdb249a7e8b45ec93","epochSnarkData":{"bitmap": "0x01a72267ae3fe9fffb","signature": "0xcd803565d415c14b42d3aee51c5de1f6fd7d33cd036f03178c104c787a6ceafb8dd2b357d5fb5992fc2a23706625c800"}}"#; - let _block: Block = serde_json::from_str(&block).unwrap(); + let _block: Block = serde_json::from_str(block).unwrap(); } } diff --git a/ethers-etherscan/src/lib.rs b/ethers-etherscan/src/lib.rs index 3cf55d09..86d45db8 100644 --- a/ethers-etherscan/src/lib.rs +++ b/ethers-etherscan/src/lib.rs @@ -447,6 +447,6 @@ mod tests { .optimization(true) .runs(200); - let resp = client.submit_contract_verification(&contract).await; + let _resp = client.submit_contract_verification(&contract).await; } } diff --git a/ethers-middleware/tests/signer.rs b/ethers-middleware/tests/signer.rs index 798957dc..91b0b163 100644 --- a/ethers-middleware/tests/signer.rs +++ b/ethers-middleware/tests/signer.rs @@ -1,3 +1,4 @@ +#![allow(unused)] use ethers_providers::{Http, JsonRpcClient, Middleware, Provider}; use ethers_core::{ @@ -368,9 +369,9 @@ impl TestWallets { pub fn next(&self) -> LocalWallet { let idx = self.next.fetch_add(1, std::sync::atomic::Ordering::SeqCst); - let wallet = self.get(idx); + // println!("Got wallet {:?}", wallet.address()); - wallet + self.get(idx) } pub fn get>(&self, idx: T) -> LocalWallet { diff --git a/ethers-middleware/tests/transformer.rs b/ethers-middleware/tests/transformer.rs index 43b884ca..2c40cbfa 100644 --- a/ethers-middleware/tests/transformer.rs +++ b/ethers-middleware/tests/transformer.rs @@ -1,4 +1,5 @@ #![cfg(not(target_arch = "wasm32"))] +#![allow(unused)] use ethers_contract::{BaseContract, ContractFactory}; use ethers_core::{ types::*, diff --git a/ethers-signers/src/aws/mod.rs b/ethers-signers/src/aws/mod.rs index d53a3c1b..36b4faec 100644 --- a/ethers-signers/src/aws/mod.rs +++ b/ethers-signers/src/aws/mod.rs @@ -188,7 +188,7 @@ impl<'a> AwsSigner<'a> { where T: AsRef, { - Ok(request_get_pubkey(&self.kms, key_id) + Ok(request_get_pubkey(self.kms, key_id) .await .map(utils::decode_pubkey)??) } @@ -207,7 +207,7 @@ impl<'a> AwsSigner<'a> { where T: AsRef, { - Ok(request_sign_digest(&self.kms, key_id, digest) + Ok(request_sign_digest(self.kms, key_id, digest) .await .map(utils::decode_signature)??) } diff --git a/ethers-signers/src/aws/utils.rs b/ethers-signers/src/aws/utils.rs index 7b98ec5a..2cd79a00 100644 --- a/ethers-signers/src/aws/utils.rs +++ b/ethers-signers/src/aws/utils.rs @@ -26,8 +26,8 @@ pub(super) fn rsig_to_ethsig(sig: &RSig) -> EthSig { let v = (v + 27) as u64; let r_bytes: FieldBytes = sig.r().into(); let s_bytes: FieldBytes = sig.s().into(); - let r = U256::from_big_endian(&r_bytes.as_slice()); - let s = U256::from_big_endian(&s_bytes.as_slice()); + let r = U256::from_big_endian(r_bytes.as_slice()); + let s = U256::from_big_endian(s_bytes.as_slice()); EthSig { r, s, v } } @@ -82,7 +82,7 @@ pub(super) fn decode_pubkey(resp: GetPublicKeyResponse) -> Result Result { - let data = APDUData::new(&Self::path_to_bytes(&derivation)); + let data = APDUData::new(&Self::path_to_bytes(derivation)); let transport = self.transport.lock().await; Self::get_address_with_path_transport(&transport, derivation).await } @@ -75,7 +75,7 @@ impl LedgerEthereum { transport: &Ledger, derivation: &DerivationType, ) -> Result { - let data = APDUData::new(&Self::path_to_bytes(&derivation)); + let data = APDUData::new(&Self::path_to_bytes(derivation)); let command = APDUCommand { ins: INS::GET_PUBLIC_KEY as u8, diff --git a/ethers-signers/src/ledger/mod.rs b/ethers-signers/src/ledger/mod.rs index 8c1d7324..f2f42fe3 100644 --- a/ethers-signers/src/ledger/mod.rs +++ b/ethers-signers/src/ledger/mod.rs @@ -5,11 +5,9 @@ use crate::Signer; use app::LedgerEthereum; use async_trait::async_trait; use ethers_core::types::{ - transaction::eip2718::TypedTransaction, - transaction::eip712::{EIP712Domain, Eip712}, - Address, Signature, + transaction::eip2718::TypedTransaction, transaction::eip712::Eip712, Address, Signature, }; -use types::{LedgerError, INS}; +use types::LedgerError; #[cfg_attr(target_arch = "wasm32", async_trait(?Send))] #[cfg_attr(not(target_arch = "wasm32"), async_trait)] diff --git a/ethers-signers/src/ledger/types.rs b/ethers-signers/src/ledger/types.rs index eee344c2..31cee31a 100644 --- a/ethers-signers/src/ledger/types.rs +++ b/ethers-signers/src/ledger/types.rs @@ -1,3 +1,4 @@ +#![allow(clippy::upper_case_acronyms)] //! Helpers for interacting with the Ethereum Ledger App //! [Official Docs](https://github.com/LedgerHQ/app-ethereum/blob/master/doc/ethapp.asc) use std::fmt;