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

Commit

Permalink
chore(clippy): make clippy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse committed Dec 3, 2022
1 parent a88d2d0 commit 35bbeab
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 29 deletions.
7 changes: 3 additions & 4 deletions ethers-contract/ethers-contract-abigen/src/multi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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())
Expand Down
3 changes: 1 addition & 2 deletions ethers-contract/ethers-contract-abigen/src/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,7 @@ fn get_etherscan_contract(address: Address, domain: &str) -> Result<String> {
};

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}"))?;

Expand Down
3 changes: 1 addition & 2 deletions ethers-contract/ethers-contract-derive/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
3 changes: 1 addition & 2 deletions ethers-core/src/types/ens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
))),
}
}
Expand Down
2 changes: 1 addition & 1 deletion ethers-core/src/types/txpool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
};
Expand Down
5 changes: 2 additions & 3 deletions ethers-providers/src/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1303,8 +1303,7 @@ impl<P: JsonRpcClient> Provider<P> {

if data.is_empty() {
return Err(ProviderError::EnsError(format!(
"`{}` resolver ({:?}) is invalid.",
ens_name, resolver_address
"`{ens_name}` resolver ({resolver_address:?}) is invalid."
)))
}

Expand Down Expand Up @@ -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)
}
Expand Down
5 changes: 2 additions & 3 deletions ethers-providers/tests/ws_errors.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![cfg(not(target_arch = "wasm32"))]
use ethers_providers::{Middleware, Provider, StreamExt};
#![allow(unused)]
use ethers_providers::{Provider, StreamExt, Ws};
use futures_util::SinkExt;
use std::time::Duration;
use tokio::net::{TcpListener, TcpStream};
Expand All @@ -18,7 +18,6 @@ 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::*;
Expand Down
3 changes: 1 addition & 2 deletions ethers-solc/src/artifacts/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions ethers-solc/src/project_util/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,10 +475,9 @@ contract {} {{}}
format!(
r#"
// SPDX-License-Identifier: UNLICENSED
pragma solidity {};
{}
pragma solidity {version};
{imports}
"#,
version, imports,
)
}
}
Expand Down
6 changes: 2 additions & 4 deletions ethers-solc/src/resolver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions ethers-solc/tests/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1709,10 +1709,9 @@ async fn can_install_solc_and_compile_version() {
"Contract",
format!(
r#"
pragma solidity {};
pragma solidity {version};
contract Contract {{ }}
"#,
version
"#
),
)
.unwrap();
Expand Down

0 comments on commit 35bbeab

Please sign in to comment.