chore: fix lints (#329)

This commit is contained in:
Georgios Konstantopoulos 2021-07-05 14:03:38 +03:00 committed by GitHub
parent 7b68c70cd9
commit 0453ea84df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 26 additions and 26 deletions

View File

@ -38,7 +38,7 @@ pub static ADDRESS_BOOK: Lazy<HashMap<U256, Address>> = Lazy::new(|| {
let addr =
Address::from_str("2cc8688c5f75e365aaeeb4ea8d6a480405a48d2a").expect("Decoding failed");
m.insert(U256::from(42u8), addr);
// xdai
let addr =
Address::from_str("b5b692a88bdfc81ca69dcb1d924f59f0413a602a").expect("Decoding failed");

View File

@ -1,7 +1,4 @@
use ethers::{
contract::ContractFactory,
types::{BlockId, H256},
};
use ethers::{contract::ContractFactory, types::H256};
mod common;
pub use common::*;
@ -12,7 +9,7 @@ mod eth_tests {
use ethers::{
contract::{LogMeta, Multicall},
providers::{Http, Middleware, PendingTransaction, Provider, StreamExt},
types::{Address, U256},
types::{Address, BlockId, U256},
utils::Ganache,
};
use std::{convert::TryFrom, sync::Arc};

View File

@ -537,7 +537,7 @@ mod tests {
fn parses_event() {
assert_eq!(
AbiParser::default()
.parse_event(&mut "event Foo (address indexed x, uint y, bytes32[] z)")
.parse_event("event Foo (address indexed x, uint y, bytes32[] z)")
.unwrap(),
Event {
anonymous: false,
@ -567,7 +567,7 @@ mod tests {
fn parses_anonymous_event() {
assert_eq!(
AbiParser::default()
.parse_event(&mut "event Foo() anonymous")
.parse_event("event Foo() anonymous")
.unwrap(),
Event {
anonymous: true,
@ -581,7 +581,7 @@ mod tests {
fn parses_unnamed_event() {
assert_eq!(
AbiParser::default()
.parse_event(&mut "event Foo(address)")
.parse_event("event Foo(address)")
.unwrap(),
Event {
anonymous: false,
@ -599,7 +599,7 @@ mod tests {
fn parses_unnamed_indexed_event() {
assert_eq!(
AbiParser::default()
.parse_event(&mut "event Foo(address indexed)")
.parse_event("event Foo(address indexed)")
.unwrap(),
Event {
anonymous: false,

View File

@ -1,6 +1,6 @@
//! This module contains an 256-bit signed integer implementation.
//! This module was derived for ethers-core via https://github.com/gnosis/ethcontract-rs/
#![allow(clippy::wrong_self_convention)]
use crate::abi::{InvalidOutputType, Token, Tokenizable};
use crate::types::U256;
use ethabi::ethereum_types::FromDecStrErr;
@ -1135,6 +1135,7 @@ macro_rules! impl_shift {
}
}
/// Implements the logical shift right operation
impl ops::Shr<$t> for I256 {
type Output = Self;

View File

@ -446,18 +446,18 @@ mod tests {
let addr: Address = "f817796F60D268A36a57b8D2dF1B97B14C0D0E1d".parse().unwrap();
let filter = Filter::new();
let ser = serialize(&filter.clone());
let ser = serialize(&filter);
assert_eq!(ser, json!({ "topics": [] }));
let filter = filter.address(addr);
let ser = serialize(&filter.clone());
let ser = serialize(&filter);
assert_eq!(ser, json!({"address" : addr, "topics": []}));
let filter = filter.event(event);
// 0
let ser = serialize(&filter.clone());
let ser = serialize(&filter);
assert_eq!(ser, json!({ "address" : addr, "topics": [t0]}));
// 1
@ -497,7 +497,7 @@ mod tests {
);
// 1 & 2 & 3
let ser = serialize(&filter.clone().topic1(t1).topic2(t2).topic3(t3));
let ser = serialize(&filter.topic1(t1).topic2(t2).topic3(t3));
assert_eq!(
ser,
json!({ "address" : addr, "topics": [t0, t1_padded, t2, t3_padded]})

View File

@ -134,6 +134,7 @@ impl Signature {
}
/// Copies and serializes `self` into a new `Vec` with the recovery id included
#[allow(clippy::wrong_self_convention)]
pub fn to_vec(&self) -> Vec<u8> {
self.into()
}

View File

@ -362,7 +362,7 @@ mod tests {
);
pending_map.insert(
Address::from_str("201354729f8d0f8b64e9a0c353c672c6a66b3857").unwrap(),
pending_map_inner.clone(),
pending_map_inner,
);
let mut queued_map = BTreeMap::new();
let mut queued_map_inner = BTreeMap::new();
@ -400,7 +400,7 @@ mod tests {
);
queued_map.insert(
Address::from_str("307e8f249bcccfa5b245449256c5d7e6e079943e").unwrap(),
queued_map_inner.clone(),
queued_map_inner,
);
TxpoolInspect {

View File

@ -89,6 +89,7 @@ mod tests {
}
#[test]
#[allow(clippy::float_cmp)]
fn behaves_with_realistic_values() {
let oracle = GeometricGasPrice::new(1.25, 10u64, None::<u64>);
const GWEI: f64 = 1000000000.0;

View File

@ -21,7 +21,7 @@ async fn gas_escalator_live() {
let address = wallet.address();
let provider = SignerMiddleware::new(provider, wallet);
let escalator = GeometricGasPrice::new(5.0, 10u64, Some(2000_000_000_000u64));
let escalator = GeometricGasPrice::new(5.0, 10u64, Some(2_000_000_000_000u64));
let provider = GasEscalatorMiddleware::new(provider, escalator, Frequency::Duration(3000));

View File

@ -71,8 +71,8 @@ mod tests {
use super::*;
fn assert_hex(hash: H256, val: &str) {
let v = if val.starts_with("0x") {
&val[2..]
let v = if let Some(stripped) = val.strip_prefix("0x") {
stripped
} else {
val
};

View File

@ -899,10 +899,10 @@ mod tests {
let provider = Provider::<Http>::try_from(ganache.endpoint())
.unwrap()
.with_sender(ganache.addresses()[0]);
assert_eq!(provider.is_signer().await, true);
assert!(provider.is_signer().await);
let provider = Provider::<Http>::try_from(ganache.endpoint()).unwrap();
assert_eq!(provider.is_signer().await, false);
assert!(!provider.is_signer().await);
let sender = Address::from_str("635B4764D1939DfAcD3a8014726159abC277BecC")
.expect("should be able to parse hex address");
@ -911,7 +911,7 @@ mod tests {
)
.unwrap()
.with_sender(sender);
assert_eq!(provider.is_signer().await, false);
assert!(!provider.is_signer().await);
}
#[tokio::test]

View File

@ -323,7 +323,7 @@ mod tests {
if let Some(ref sent) = sent {
assert_eq!(sent.len(), watch_received.len());
let sent_txs = sent
.into_iter()
.iter()
.map(|tx| tx.transaction_hash)
.collect::<HashSet<_>>();
assert_eq!(sent_txs, watch_received.iter().map(|tx| tx.hash).collect());

View File

@ -10,7 +10,7 @@ async fn txpool() {
let geth = Geth::new().block_time(20u64).spawn();
let provider = Provider::<Http>::try_from(geth.endpoint()).unwrap();
let account = provider.get_accounts().await.unwrap()[0].clone();
let account = provider.get_accounts().await.unwrap()[0];
let value: u64 = 42;
let gas_price = ethers::types::U256::from_dec_str("221435145689").unwrap();
let mut tx = TransactionRequest::new()

View File

@ -180,7 +180,7 @@ impl LedgerEthereum {
let v = result[0] as u64;
let r = H256::from_slice(&result[1..33]);
let s = H256::from_slice(&result[33..]);
Ok(Signature { v, r, s })
Ok(Signature { r, s, v })
}
// helper which converts a derivation path to bytes