diff --git a/ethers-core/src/types/chain.rs b/ethers-core/src/types/chain.rs index f5f2f760..e423b1a6 100644 --- a/ethers-core/src/types/chain.rs +++ b/ethers-core/src/types/chain.rs @@ -5,7 +5,7 @@ use std::{ fmt, time::Duration, }; -use strum::{AsRefStr, EnumString, EnumVariantNames}; +use strum::{AsRefStr, EnumCount, EnumIter, EnumString, EnumVariantNames}; // compatibility re-export #[doc(hidden)] @@ -33,6 +33,8 @@ pub type ParseChainError = TryFromPrimitiveError; AsRefStr, // also for fmt::Display and serde::Serialize EnumVariantNames, // Self::VARIANTS EnumString, // FromStr, TryFrom<&str> + EnumIter, + EnumCount, TryFromPrimitive, // TryFrom Deserialize, )] @@ -372,9 +374,15 @@ impl Chain { #[cfg(test)] mod tests { use super::*; + use strum::IntoEnumIterator; #[test] fn test_default_chain() { assert_eq!(serde_json::to_string(&Chain::default()).unwrap(), "\"mainnet\""); } + + #[test] + fn test_enum_iter() { + assert_eq!(Chain::COUNT, Chain::iter().size_hint().0); + } } diff --git a/ethers-solc/src/sourcemap.rs b/ethers-solc/src/sourcemap.rs index 5e722368..f9b75844 100644 --- a/ethers-solc/src/sourcemap.rs +++ b/ethers-solc/src/sourcemap.rs @@ -512,7 +512,7 @@ mod tests { let source_maps = include_str!("../test-data/out-source-maps.txt"); for (line, s) in source_maps.lines().enumerate() { - parse(s).unwrap_or_else(|_| panic!("Failed to parse line {}", line)); + parse(s).unwrap_or_else(|_| panic!("Failed to parse line {line}")); } } diff --git a/ethers-solc/src/utils.rs b/ethers-solc/src/utils.rs index bb4d0a3b..aba0a883 100644 --- a/ethers-solc/src/utils.rs +++ b/ethers-solc/src/utils.rs @@ -506,7 +506,7 @@ mod tests { let existing = path.join("Test.sol"); let non_existing = path.join("test.sol"); std::fs::write( - &existing, + existing, r#" pragma solidity ^0.8.10; contract A {} diff --git a/examples/providers/examples/retry.rs b/examples/providers/examples/retry.rs index 9146bd84..8f78b689 100644 --- a/examples/providers/examples/retry.rs +++ b/examples/providers/examples/retry.rs @@ -19,7 +19,7 @@ async fn main() -> eyre::Result<()> { .rate_limit_retries(10) .timeout_retries(3) .initial_backoff(Duration::from_millis(500)) - .build(provider, Box::new(HttpRateLimitRetryPolicy::default())); + .build(provider, Box::::default()); // Send a JSON-RPC request for the latest block let block_num = "latest".to_string();