chore(clippy): make clippy happy (#1778)
This commit is contained in:
parent
ef22e05a9a
commit
676f039230
|
@ -464,7 +464,8 @@ impl AbiParser {
|
|||
fn parse_param(&self, param: &str) -> Result<(Param, Option<String>)> {
|
||||
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;
|
||||
if let Some(ty) = iter.last() {
|
||||
|
|
|
@ -270,7 +270,7 @@ impl ClientBuilder {
|
|||
let (etherscan_api_url, etherscan_url) = chain
|
||||
.etherscan_urls()
|
||||
.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?)
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ pub async fn lookup_compiler_version(version: &Version) -> Result<Version> {
|
|||
.lines()
|
||||
.find(|l| !l.contains("nightly") && l.contains(&version))
|
||||
.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"))
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ impl LinearGasPrice {
|
|||
|
||||
impl GasEscalator for LinearGasPrice {
|
||||
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);
|
||||
if let Some(max_price) = self.max_price {
|
||||
result = std::cmp::min(result, max_price);
|
||||
|
|
|
@ -4,8 +4,8 @@ fn main() -> eyre::Result<()> {
|
|||
let mut args = std::env::args();
|
||||
args.next().unwrap(); // skip program name
|
||||
|
||||
let contract_name = args.next().unwrap_or("SimpleStorage".to_owned());
|
||||
let contract: String = args.next().unwrap_or("examples/contract.sol".to_owned());
|
||||
let contract_name = args.next().unwrap_or_else(|| "SimpleStorage".to_owned());
|
||||
let contract: String = args.next().unwrap_or_else(|| "examples/contract.sol".to_owned());
|
||||
|
||||
println!("Generating bindings for {}\n", contract);
|
||||
|
||||
|
|
Loading…
Reference in New Issue