chore(clippy): make clippy happy (#1923)
This commit is contained in:
parent
556821f077
commit
3dfc04f9fe
|
@ -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, "# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html")?;
|
||||||
writeln!(toml)?;
|
writeln!(toml)?;
|
||||||
writeln!(toml, "[dependencies]")?;
|
writeln!(toml, "[dependencies]")?;
|
||||||
writeln!(toml, r#"{}"#, crate_version)?;
|
writeln!(toml, r#"{crate_version}"#)?;
|
||||||
Ok(toml)
|
Ok(toml)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -619,11 +619,10 @@ impl MultiBindingsInner {
|
||||||
.ok_or_else(|| eyre::eyre!("couldn't find ethers or ethers-contract dependency"))?;
|
.ok_or_else(|| eyre::eyre!("couldn't find ethers or ethers-contract dependency"))?;
|
||||||
|
|
||||||
if let Some(rev) = ethers.get("rev") {
|
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") {
|
} else if let Some(version) = ethers.get("version") {
|
||||||
Ok(format!(
|
Ok(format!(
|
||||||
"ethers = {{ version = {}, default-features = false, features = [\"abigen\"] }}",
|
"ethers = {{ version = {version}, default-features = false, features = [\"abigen\"] }}"
|
||||||
version
|
|
||||||
))
|
))
|
||||||
} else {
|
} else {
|
||||||
Ok(DEFAULT_ETHERS_DEP.to_string())
|
Ok(DEFAULT_ETHERS_DEP.to_string())
|
||||||
|
|
|
@ -270,8 +270,7 @@ fn get_etherscan_contract(address: Address, domain: &str) -> Result<String> {
|
||||||
};
|
};
|
||||||
|
|
||||||
let abi_url = format!(
|
let abi_url = format!(
|
||||||
"http://api.{}/api?module=contract&action=getabi&address={:?}&format=raw{}",
|
"http://api.{domain}/api?module=contract&action=getabi&address={address:?}&format=raw{api_key}",
|
||||||
domain, address, api_key,
|
|
||||||
);
|
);
|
||||||
let abi = util::http_get(&abi_url).context(format!("failed to retrieve ABI from {domain}"))?;
|
let abi = util::http_get(&abi_url).context(format!("failed to retrieve ABI from {domain}"))?;
|
||||||
|
|
||||||
|
|
|
@ -464,8 +464,7 @@ fn parse_event_attributes(
|
||||||
return Err(Error::new(
|
return Err(Error::new(
|
||||||
meta.span(),
|
meta.span(),
|
||||||
format!(
|
format!(
|
||||||
"Expected hex signature: {:?}",
|
"Expected hex signature: {err:?}"
|
||||||
err
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.to_compile_error())
|
.to_compile_error())
|
||||||
|
|
|
@ -59,8 +59,7 @@ impl Serialize for NameOrAddress {
|
||||||
match self {
|
match self {
|
||||||
Self::Address(addr) => addr.serialize(serializer),
|
Self::Address(addr) => addr.serialize(serializer),
|
||||||
Self::Name(name) => Err(SerializationError::custom(format!(
|
Self::Name(name) => Err(SerializationError::custom(format!(
|
||||||
"cannot serialize ENS name {}, must be address",
|
"cannot serialize ENS name {name}, must be address"
|
||||||
name
|
|
||||||
))),
|
))),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ impl Serialize for TxpoolInspectSummary {
|
||||||
S: serde::Serializer,
|
S: serde::Serializer,
|
||||||
{
|
{
|
||||||
let formatted_to = if let Some(to) = self.to {
|
let formatted_to = if let Some(to) = self.to {
|
||||||
format!("{:?}", to)
|
format!("{to:?}")
|
||||||
} else {
|
} else {
|
||||||
"contract creation".to_string()
|
"contract creation".to_string()
|
||||||
};
|
};
|
||||||
|
|
|
@ -1303,8 +1303,7 @@ impl<P: JsonRpcClient> Provider<P> {
|
||||||
|
|
||||||
if data.is_empty() {
|
if data.is_empty() {
|
||||||
return Err(ProviderError::EnsError(format!(
|
return Err(ProviderError::EnsError(format!(
|
||||||
"`{}` resolver ({:?}) is invalid.",
|
"`{ens_name}` resolver ({resolver_address:?}) is invalid."
|
||||||
ens_name, resolver_address
|
|
||||||
)))
|
)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2234,7 +2233,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
.spawn();
|
.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();
|
let provider = Provider::try_from(url).unwrap();
|
||||||
(geth, provider)
|
(geth, provider)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#![cfg(not(target_arch = "wasm32"))]
|
#![allow(unused)]
|
||||||
use ethers_providers::{Middleware, Provider, StreamExt};
|
use ethers_providers::{Middleware, Provider, StreamExt, Ws};
|
||||||
use futures_util::SinkExt;
|
use futures_util::SinkExt;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use tokio::net::{TcpListener, TcpStream};
|
use tokio::net::{TcpListener, TcpStream};
|
||||||
|
@ -17,11 +17,9 @@ const WS_ENDPOINT: &str = "127.0.0.1:9002";
|
||||||
|
|
||||||
#[cfg(not(feature = "celo"))]
|
#[cfg(not(feature = "celo"))]
|
||||||
mod eth_tests {
|
mod eth_tests {
|
||||||
use ethers_core::types::Filter;
|
|
||||||
use ethers_providers::{StreamExt, Ws};
|
|
||||||
use tokio_tungstenite::connect_async;
|
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use ethers_core::types::Filter;
|
||||||
|
use tokio_tungstenite::connect_async;
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn graceful_disconnect_on_ws_errors() {
|
async fn graceful_disconnect_on_ws_errors() {
|
||||||
|
|
|
@ -532,8 +532,7 @@ impl Libraries {
|
||||||
.ok_or_else(|| SolcError::msg(format!("failed to parse library address: {lib}")))?;
|
.ok_or_else(|| SolcError::msg(format!("failed to parse library address: {lib}")))?;
|
||||||
if items.next().is_some() {
|
if items.next().is_some() {
|
||||||
return Err(SolcError::msg(format!(
|
return Err(SolcError::msg(format!(
|
||||||
"failed to parse, too many arguments passed: {}",
|
"failed to parse, too many arguments passed: {lib}"
|
||||||
lib
|
|
||||||
)))
|
)))
|
||||||
}
|
}
|
||||||
libraries
|
libraries
|
||||||
|
|
|
@ -475,10 +475,9 @@ contract {} {{}}
|
||||||
format!(
|
format!(
|
||||||
r#"
|
r#"
|
||||||
// SPDX-License-Identifier: UNLICENSED
|
// SPDX-License-Identifier: UNLICENSED
|
||||||
pragma solidity {};
|
pragma solidity {version};
|
||||||
{}
|
{imports}
|
||||||
"#,
|
"#,
|
||||||
version, imports,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -587,8 +587,7 @@ impl Graph {
|
||||||
let mut msg = String::new();
|
let mut msg = String::new();
|
||||||
self.format_imports_list(idx, &mut msg).unwrap();
|
self.format_imports_list(idx, &mut msg).unwrap();
|
||||||
errors.push(format!(
|
errors.push(format!(
|
||||||
"Discovered incompatible solidity versions in following\n: {}",
|
"Discovered incompatible solidity versions in following\n: {msg}"
|
||||||
msg
|
|
||||||
));
|
));
|
||||||
erroneous_nodes.insert(idx);
|
erroneous_nodes.insert(idx);
|
||||||
} else {
|
} else {
|
||||||
|
@ -777,8 +776,7 @@ impl VersionedSources {
|
||||||
let solc = if !version.is_installed() {
|
let solc = if !version.is_installed() {
|
||||||
if self.offline {
|
if self.offline {
|
||||||
return Err(SolcError::msg(format!(
|
return Err(SolcError::msg(format!(
|
||||||
"missing solc \"{}\" installation in offline mode",
|
"missing solc \"{version}\" installation in offline mode"
|
||||||
version
|
|
||||||
)))
|
)))
|
||||||
} else {
|
} else {
|
||||||
// install missing solc
|
// install missing solc
|
||||||
|
|
|
@ -1709,10 +1709,9 @@ async fn can_install_solc_and_compile_version() {
|
||||||
"Contract",
|
"Contract",
|
||||||
format!(
|
format!(
|
||||||
r#"
|
r#"
|
||||||
pragma solidity {};
|
pragma solidity {version};
|
||||||
contract Contract {{ }}
|
contract Contract {{ }}
|
||||||
"#,
|
"#
|
||||||
version
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
Loading…
Reference in New Issue