diff --git a/ethers-contract/ethers-contract-abigen/src/multi.rs b/ethers-contract/ethers-contract-abigen/src/multi.rs index 76e37b66..f4bd7837 100644 --- a/ethers-contract/ethers-contract-abigen/src/multi.rs +++ b/ethers-contract/ethers-contract-abigen/src/multi.rs @@ -586,7 +586,7 @@ impl MultiBindingsInner { writeln!(toml, "# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html")?; writeln!(toml)?; writeln!(toml, "[dependencies]")?; - writeln!(toml, r#"{}"#, crate_version)?; + writeln!(toml, r#"{crate_version}"#)?; Ok(toml) } @@ -619,11 +619,10 @@ impl MultiBindingsInner { .ok_or_else(|| eyre::eyre!("couldn't find ethers or ethers-contract dependency"))?; if let Some(rev) = ethers.get("rev") { - Ok(format!("ethers = {{ git = \"https://github.com/gakonst/ethers-rs\", rev = {}, default-features = false, features = [\"abigen\"] }}", rev)) + Ok(format!("ethers = {{ git = \"https://github.com/gakonst/ethers-rs\", rev = {rev}, default-features = false, features = [\"abigen\"] }}")) } else if let Some(version) = ethers.get("version") { Ok(format!( - "ethers = {{ version = {}, default-features = false, features = [\"abigen\"] }}", - version + "ethers = {{ version = {version}, default-features = false, features = [\"abigen\"] }}" )) } else { Ok(DEFAULT_ETHERS_DEP.to_string()) diff --git a/ethers-contract/ethers-contract-abigen/src/source.rs b/ethers-contract/ethers-contract-abigen/src/source.rs index 751c1e41..0ddda89c 100644 --- a/ethers-contract/ethers-contract-abigen/src/source.rs +++ b/ethers-contract/ethers-contract-abigen/src/source.rs @@ -270,8 +270,7 @@ fn get_etherscan_contract(address: Address, domain: &str) -> Result { }; let abi_url = format!( - "http://api.{}/api?module=contract&action=getabi&address={:?}&format=raw{}", - domain, address, api_key, + "http://api.{domain}/api?module=contract&action=getabi&address={address:?}&format=raw{api_key}", ); let abi = util::http_get(&abi_url).context(format!("failed to retrieve ABI from {domain}"))?; diff --git a/ethers-contract/ethers-contract-derive/src/event.rs b/ethers-contract/ethers-contract-derive/src/event.rs index 0e56314f..e2a1b7ec 100644 --- a/ethers-contract/ethers-contract-derive/src/event.rs +++ b/ethers-contract/ethers-contract-derive/src/event.rs @@ -464,8 +464,7 @@ fn parse_event_attributes( return Err(Error::new( meta.span(), format!( - "Expected hex signature: {:?}", - err + "Expected hex signature: {err:?}" ), ) .to_compile_error()) diff --git a/ethers-core/src/types/ens.rs b/ethers-core/src/types/ens.rs index 1ba9869f..af8faaab 100644 --- a/ethers-core/src/types/ens.rs +++ b/ethers-core/src/types/ens.rs @@ -59,8 +59,7 @@ impl Serialize for NameOrAddress { match self { Self::Address(addr) => addr.serialize(serializer), Self::Name(name) => Err(SerializationError::custom(format!( - "cannot serialize ENS name {}, must be address", - name + "cannot serialize ENS name {name}, must be address" ))), } } diff --git a/ethers-core/src/types/txpool.rs b/ethers-core/src/types/txpool.rs index b655190d..dc6a38ef 100644 --- a/ethers-core/src/types/txpool.rs +++ b/ethers-core/src/types/txpool.rs @@ -91,7 +91,7 @@ impl Serialize for TxpoolInspectSummary { S: serde::Serializer, { let formatted_to = if let Some(to) = self.to { - format!("{:?}", to) + format!("{to:?}") } else { "contract creation".to_string() }; diff --git a/ethers-providers/src/provider.rs b/ethers-providers/src/provider.rs index 496c312f..71cf41ce 100644 --- a/ethers-providers/src/provider.rs +++ b/ethers-providers/src/provider.rs @@ -1303,8 +1303,7 @@ impl Provider

{ if data.is_empty() { return Err(ProviderError::EnsError(format!( - "`{}` resolver ({:?}) is invalid.", - ens_name, resolver_address + "`{ens_name}` resolver ({resolver_address:?}) is invalid." ))) } @@ -2234,7 +2233,7 @@ mod tests { } .spawn(); - let url = format!("http://127.0.0.1:{}", rpc_port); + let url = format!("http://127.0.0.1:{rpc_port}"); let provider = Provider::try_from(url).unwrap(); (geth, provider) } diff --git a/ethers-providers/tests/ws_errors.rs b/ethers-providers/tests/ws_errors.rs index 812b3dd4..b70b2c96 100644 --- a/ethers-providers/tests/ws_errors.rs +++ b/ethers-providers/tests/ws_errors.rs @@ -1,5 +1,5 @@ -#![cfg(not(target_arch = "wasm32"))] -use ethers_providers::{Middleware, Provider, StreamExt}; +#![allow(unused)] +use ethers_providers::{Middleware, Provider, StreamExt, Ws}; use futures_util::SinkExt; use std::time::Duration; use tokio::net::{TcpListener, TcpStream}; @@ -17,11 +17,9 @@ const WS_ENDPOINT: &str = "127.0.0.1:9002"; #[cfg(not(feature = "celo"))] mod eth_tests { - use ethers_core::types::Filter; - use ethers_providers::{StreamExt, Ws}; - use tokio_tungstenite::connect_async; - use super::*; + use ethers_core::types::Filter; + use tokio_tungstenite::connect_async; #[tokio::test] async fn graceful_disconnect_on_ws_errors() { diff --git a/ethers-solc/src/artifacts/mod.rs b/ethers-solc/src/artifacts/mod.rs index e3dd5961..0a0d1dd0 100644 --- a/ethers-solc/src/artifacts/mod.rs +++ b/ethers-solc/src/artifacts/mod.rs @@ -532,8 +532,7 @@ impl Libraries { .ok_or_else(|| SolcError::msg(format!("failed to parse library address: {lib}")))?; if items.next().is_some() { return Err(SolcError::msg(format!( - "failed to parse, too many arguments passed: {}", - lib + "failed to parse, too many arguments passed: {lib}" ))) } libraries diff --git a/ethers-solc/src/project_util/mock.rs b/ethers-solc/src/project_util/mock.rs index 8a467aea..f3b4840e 100644 --- a/ethers-solc/src/project_util/mock.rs +++ b/ethers-solc/src/project_util/mock.rs @@ -475,10 +475,9 @@ contract {} {{}} format!( r#" // SPDX-License-Identifier: UNLICENSED -pragma solidity {}; -{} +pragma solidity {version}; +{imports} "#, - version, imports, ) } } diff --git a/ethers-solc/src/resolver/mod.rs b/ethers-solc/src/resolver/mod.rs index 985f686d..eceba2e1 100644 --- a/ethers-solc/src/resolver/mod.rs +++ b/ethers-solc/src/resolver/mod.rs @@ -587,8 +587,7 @@ impl Graph { let mut msg = String::new(); self.format_imports_list(idx, &mut msg).unwrap(); errors.push(format!( - "Discovered incompatible solidity versions in following\n: {}", - msg + "Discovered incompatible solidity versions in following\n: {msg}" )); erroneous_nodes.insert(idx); } else { @@ -777,8 +776,7 @@ impl VersionedSources { let solc = if !version.is_installed() { if self.offline { return Err(SolcError::msg(format!( - "missing solc \"{}\" installation in offline mode", - version + "missing solc \"{version}\" installation in offline mode" ))) } else { // install missing solc diff --git a/ethers-solc/tests/project.rs b/ethers-solc/tests/project.rs index 84bc9bfb..45aa9079 100644 --- a/ethers-solc/tests/project.rs +++ b/ethers-solc/tests/project.rs @@ -1709,10 +1709,9 @@ async fn can_install_solc_and_compile_version() { "Contract", format!( r#" -pragma solidity {}; +pragma solidity {version}; contract Contract {{ }} -"#, - version +"# ), ) .unwrap();