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

chore(clippy): make clippy happy #1778

Merged
merged 1 commit into from
Oct 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ethers-core/src/abi/human_readable/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion ethers-etherscan/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?)
}

Expand Down
2 changes: 1 addition & 1 deletion ethers-etherscan/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
}
Expand Down
2 changes: 1 addition & 1 deletion ethers-middleware/src/gas_escalator/linear.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions examples/abigen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down