Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
chore: fix lints (#329)
Browse files Browse the repository at this point in the history
  • Loading branch information
gakonst authored Jul 5, 2021
1 parent 7b68c70 commit 0453ea8
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion ethers-contract/src/multicall/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
7 changes: 2 additions & 5 deletions ethers-contract/tests/contract.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
use ethers::{
contract::ContractFactory,
types::{BlockId, H256},
};
use ethers::{contract::ContractFactory, types::H256};

mod common;
pub use common::*;
Expand All @@ -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};
Expand Down
8 changes: 4 additions & 4 deletions ethers-core/src/abi/human_readable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion ethers-core/src/types/i256.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -1135,6 +1135,7 @@ macro_rules! impl_shift {
}
}

/// Implements the logical shift right operation
impl ops::Shr<$t> for I256 {
type Output = Self;

Expand Down
8 changes: 4 additions & 4 deletions ethers-core/src/types/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]})
Expand Down
1 change: 1 addition & 0 deletions ethers-core/src/types/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
4 changes: 2 additions & 2 deletions ethers-core/src/types/txpool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -400,7 +400,7 @@ mod tests {
);
queued_map.insert(
Address::from_str("307e8f249bcccfa5b245449256c5d7e6e079943e").unwrap(),
queued_map_inner.clone(),
queued_map_inner,
);

TxpoolInspect {
Expand Down
1 change: 1 addition & 0 deletions ethers-middleware/src/gas_escalator/geometric.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion ethers-middleware/tests/gas_escalator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
4 changes: 2 additions & 2 deletions ethers-providers/src/ens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down
6 changes: 3 additions & 3 deletions ethers-providers/src/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -911,7 +911,7 @@ mod tests {
)
.unwrap()
.with_sender(sender);
assert_eq!(provider.is_signer().await, false);
assert!(!provider.is_signer().await);
}

#[tokio::test]
Expand Down
2 changes: 1 addition & 1 deletion ethers-providers/src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion ethers-providers/tests/txpool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion ethers-signers/src/ledger/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0453ea8

Please sign in to comment.