chore(clippy): make clippy happy (#1778)

This commit is contained in:
Matthias Seitz 2022-10-11 19:49:05 +02:00 committed by GitHub
parent ef22e05a9a
commit 676f039230
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 6 deletions

View File

@ -464,7 +464,8 @@ impl AbiParser {
fn parse_param(&self, param: &str) -> Result<(Param, Option<String>)> { fn parse_param(&self, param: &str) -> Result<(Param, Option<String>)> {
let mut iter = param.trim().rsplitn(3, is_whitespace); let mut iter = param.trim().rsplitn(3, is_whitespace);
let mut name = iter.next().ok_or(ParseError::ParseError(super::Error::InvalidData))?; let mut name =
iter.next().ok_or_else(|| ParseError::ParseError(super::Error::InvalidData))?;
let type_str; let type_str;
if let Some(ty) = iter.last() { if let Some(ty) = iter.last() {

View File

@ -270,7 +270,7 @@ impl ClientBuilder {
let (etherscan_api_url, etherscan_url) = chain let (etherscan_api_url, etherscan_url) = chain
.etherscan_urls() .etherscan_urls()
.map(|(api, base)| urls(api, base)) .map(|(api, base)| urls(api, base))
.ok_or(EtherscanError::ChainNotSupported(chain))?; .ok_or_else(|| EtherscanError::ChainNotSupported(chain))?;
self.with_api_url(etherscan_api_url?)?.with_url(etherscan_url?) self.with_api_url(etherscan_api_url?)?.with_url(etherscan_url?)
} }

View File

@ -16,7 +16,7 @@ pub async fn lookup_compiler_version(version: &Version) -> Result<Version> {
.lines() .lines()
.find(|l| !l.contains("nightly") && l.contains(&version)) .find(|l| !l.contains("nightly") && l.contains(&version))
.map(|l| l.trim_start_matches("soljson-v").trim_end_matches(".js")) .map(|l| l.trim_start_matches("soljson-v").trim_end_matches(".js"))
.ok_or(EtherscanError::MissingSolcVersion(version))?; .ok_or_else(|| EtherscanError::MissingSolcVersion(version))?;
Ok(v.parse().expect("failed to parse semver")) Ok(v.parse().expect("failed to parse semver"))
} }

View File

@ -32,7 +32,7 @@ impl LinearGasPrice {
impl GasEscalator for LinearGasPrice { impl GasEscalator for LinearGasPrice {
fn get_gas_price(&self, initial_price: U256, time_elapsed: u64) -> U256 { fn get_gas_price(&self, initial_price: U256, time_elapsed: u64) -> U256 {
let mut result = initial_price + self.increase_by * (time_elapsed / self.every_secs) as u64; let mut result = initial_price + self.increase_by * (time_elapsed / self.every_secs);
dbg!(time_elapsed, self.every_secs); dbg!(time_elapsed, self.every_secs);
if let Some(max_price) = self.max_price { if let Some(max_price) = self.max_price {
result = std::cmp::min(result, max_price); result = std::cmp::min(result, max_price);

View File

@ -4,8 +4,8 @@ fn main() -> eyre::Result<()> {
let mut args = std::env::args(); let mut args = std::env::args();
args.next().unwrap(); // skip program name args.next().unwrap(); // skip program name
let contract_name = args.next().unwrap_or("SimpleStorage".to_owned()); let contract_name = args.next().unwrap_or_else(|| "SimpleStorage".to_owned());
let contract: String = args.next().unwrap_or("examples/contract.sol".to_owned()); let contract: String = args.next().unwrap_or_else(|| "examples/contract.sol".to_owned());
println!("Generating bindings for {}\n", contract); println!("Generating bindings for {}\n", contract);