Skip to content

Commit

Permalink
chore: update CI and fix clippy (#2446)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes committed May 29, 2023
1 parent 312eab3 commit 49a8ede
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Expand Up @@ -99,7 +99,7 @@ jobs:
- uses: taiki-e/install-action@cargo-hack
- uses: Swatinem/rust-cache@v2
- name: cargo hack
run: cargo hack check --feature-powerset --depth 1 --no-dev-deps
run: cargo hack check --feature-powerset --depth 1 --all-targets

clippy:
name: clippy
Expand Down
8 changes: 4 additions & 4 deletions ethers-contract/src/lib.rs
Expand Up @@ -27,10 +27,10 @@ pub use log::{decode_logs, EthLogDecode, LogMeta};

pub mod stream;

#[cfg(any(test, feature = "abigen"))]
#[cfg(feature = "abigen")]
#[cfg_attr(docsrs, doc(cfg(feature = "abigen")))]
mod multicall;
#[cfg(any(test, feature = "abigen"))]
#[cfg(feature = "abigen")]
#[cfg_attr(docsrs, doc(cfg(feature = "abigen")))]
pub use multicall::{
constants::{MULTICALL_ADDRESS, MULTICALL_SUPPORTED_CHAIN_IDS},
Expand All @@ -50,13 +50,13 @@ pub mod builders {
};
}

#[cfg(any(test, feature = "abigen"))]
#[cfg(feature = "abigen")]
#[cfg_attr(docsrs, doc(cfg(feature = "abigen")))]
pub use ethers_contract_abigen::{
Abigen, ContractFilter, ExcludeContracts, InternalStructs, MultiAbigen, SelectContracts,
};

#[cfg(any(test, feature = "abigen"))]
#[cfg(feature = "abigen")]
#[cfg_attr(docsrs, doc(cfg(feature = "abigen")))]
pub use ethers_contract_derive::{
abigen, Eip712, EthAbiCodec, EthAbiType, EthCall, EthDisplay, EthError, EthEvent,
Expand Down
10 changes: 5 additions & 5 deletions ethers-core/src/abi/mod.rs
Expand Up @@ -3,7 +3,7 @@
//! Adapted from [Gnosis' `ethcontract-rs`](https://github.com/gnosis/ethcontract-rs).

use crate::{
types::{Bytes, Selector, Uint8, H256, H512, I256, U128, U256, U64},
types::{self, Selector, Uint8, H256, H512, I256, U128, U256, U64},
utils::id,
};
pub use ethabi::{self, Contract as Abi, *};
Expand Down Expand Up @@ -184,7 +184,7 @@ macro_rules! impl_abi_type {
}

impl_abi_type!(
Bytes => Bytes,
types::Bytes => Bytes,
bytes::Bytes => Bytes,
Vec<u8> => Array(Box::new(ParamType::Uint(8))),
Address => Address,
Expand Down Expand Up @@ -317,9 +317,9 @@ mod tests {

#[test]
fn abi_type_works() {
assert_eq!(ParamType::Bytes, Bytes::param_type());
assert_eq!(ParamType::Bytes, types::Bytes::param_type());
assert_eq!(ParamType::Array(Box::new(ParamType::Uint(8))), Vec::<u8>::param_type());
assert_eq!(ParamType::Array(Box::new(ParamType::Bytes)), Vec::<Bytes>::param_type());
assert_eq!(ParamType::Array(Box::new(ParamType::Bytes)), Vec::<types::Bytes>::param_type());
assert_eq!(
ParamType::Array(Box::new(ParamType::Array(Box::new(ParamType::Uint(8))))),
Vec::<Vec<u8>>::param_type()
Expand All @@ -335,7 +335,7 @@ mod tests {

assert_eq!(
ParamType::Tuple(vec![ParamType::Bytes, ParamType::Address]),
<(Bytes, Address)>::param_type()
<(types::Bytes, Address)>::param_type()
);

assert_eq!(ParamType::FixedBytes(32), <[u8; 32]>::param_type());
Expand Down
2 changes: 1 addition & 1 deletion ethers-middleware/src/signer.rs
Expand Up @@ -356,7 +356,7 @@ where
}
}

#[cfg(all(test, not(feature = "celo"), not(target_arch = "wasm32")))]
#[cfg(all(test, not(feature = "celo")))]
mod tests {
use super::*;
use ethers_core::{
Expand Down
1 change: 0 additions & 1 deletion ethers-providers/src/rpc/provider.rs
Expand Up @@ -1506,7 +1506,6 @@ pub fn is_local_endpoint(endpoint: &str) -> bool {
}

#[cfg(test)]
#[cfg(not(target_arch = "wasm32"))]
mod tests {
use super::*;
use crate::Http;
Expand Down
2 changes: 1 addition & 1 deletion ethers-providers/src/rpc/transports/ws/mod.rs
Expand Up @@ -192,9 +192,9 @@ impl crate::Provider<WsClient> {
Ok(Self::new(ws))
}

#[cfg(not(target_arch = "wasm32"))]
/// Connect to a WS RPC provider with authentication details and a set
/// number of reconnection attempts
#[cfg(not(target_arch = "wasm32"))]
pub async fn connect_with_auth_and_reconnects(
url: impl AsRef<str>,
auth: Authorization,
Expand Down
18 changes: 9 additions & 9 deletions ethers-providers/src/stream/tx_stream.rs
Expand Up @@ -169,25 +169,25 @@ where
}

#[cfg(test)]
#[cfg(not(target_arch = "wasm32"))]
mod tests {
use super::*;
use crate::{stream::tx_stream, Http, Ws};
use ethers_core::{
types::{Transaction, TransactionReceipt, TransactionRequest},
utils::Anvil,
};
use futures_util::{FutureExt, StreamExt};
use std::{collections::HashSet, time::Duration};
use crate::{stream::tx_stream, Http};
use ethers_core::{types::TransactionRequest, utils::Anvil};
use std::collections::HashSet;

#[tokio::test]
#[cfg(feature = "ws")]
async fn can_stream_pending_transactions() {
use ethers_core::types::{Transaction, TransactionReceipt};
use futures_util::{FutureExt, StreamExt};
use std::time::Duration;

let num_txs = 5;
let geth = Anvil::new().block_time(2u64).spawn();
let provider = Provider::<Http>::try_from(geth.endpoint())
.unwrap()
.interval(Duration::from_millis(1000));
let ws = Ws::connect(geth.ws_endpoint()).await.unwrap();
let ws = crate::Ws::connect(geth.ws_endpoint()).await.unwrap();
let ws_provider = Provider::new(ws);

let accounts = provider.get_accounts().await.unwrap();
Expand Down
2 changes: 1 addition & 1 deletion ethers-providers/tests/it/main.rs
Expand Up @@ -16,7 +16,7 @@ mod provider;

mod txpool;

#[cfg(not(feature = "celo"))]
#[cfg(all(feature = "ws", not(feature = "legacy-ws"), not(feature = "celo")))]
mod ws_errors;

/// Spawns Anvil and instantiates an Http provider.
Expand Down
2 changes: 1 addition & 1 deletion ethers-providers/tests/it/provider.rs
Expand Up @@ -28,7 +28,7 @@ mod eth_tests {

// Without TLS this would error with "TLS Support not compiled in"
#[tokio::test]
#[cfg(any(feature = "openssl", feature = "rustls"))]
#[cfg(all(feature = "ws", any(feature = "openssl", feature = "rustls")))]
async fn ssl_websocket() {
let provider = GOERLI.ws().await;
assert_ne!(provider.get_block_number().await.unwrap(), 0.into());
Expand Down
5 changes: 1 addition & 4 deletions ethers-solc/src/artifacts/mod.rs
Expand Up @@ -24,10 +24,7 @@ pub mod contract;
pub mod output_selection;
pub mod serde_helpers;
use crate::{
artifacts::{
lowfidelity::NodeType,
output_selection::{ContractOutputSelection, OutputSelection},
},
artifacts::output_selection::{ContractOutputSelection, OutputSelection},
filter::FilteredSources,
};
pub use bytecode::*;
Expand Down
2 changes: 1 addition & 1 deletion ethers-solc/src/compile/project.rs
Expand Up @@ -676,7 +676,7 @@ fn compile_parallel(
}

#[cfg(test)]
#[cfg(feature = "project-util")]
#[cfg(all(feature = "project-util", feature = "svm-solc"))]
mod tests {
use super::*;
use crate::{project_util::TempProject, MinimalCombinedArtifacts};
Expand Down

0 comments on commit 49a8ede

Please sign in to comment.