From e3fee14463253dd4c52a1226b40da72e1d40a840 Mon Sep 17 00:00:00 2001 From: ilya Date: Thu, 14 Mar 2024 17:35:25 +0000 Subject: [PATCH] Clippy --- src/configuration.rs | 3 ++- src/cow_api_client.rs | 1 + src/encoder.rs | 1 + src/ethereum_client.rs | 3 ++- src/main.rs | 2 +- 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/configuration.rs b/src/configuration.rs index 4929bc3..df9ce84 100644 --- a/src/configuration.rs +++ b/src/configuration.rs @@ -59,8 +59,9 @@ impl Configuration { } } +#[allow(dead_code)] fn collect_required_environment_variable(key: &str) -> Result { - Ok(env::var(key).context(format!("required environment variable {} not set", key))?) + env::var(key).context(format!("required environment variable {} not set", key)) } fn collect_optional_environment_variable(key: &str) -> Result> { diff --git a/src/cow_api_client.rs b/src/cow_api_client.rs index 6114cd6..5b42f77 100644 --- a/src/cow_api_client.rs +++ b/src/cow_api_client.rs @@ -90,6 +90,7 @@ impl CowAPIClient { }) } + #[allow(clippy::too_many_arguments)] pub async fn create_order( &self, order_contract: Address, diff --git a/src/encoder.rs b/src/encoder.rs index 4f16b31..9fd966a 100644 --- a/src/encoder.rs +++ b/src/encoder.rs @@ -4,6 +4,7 @@ use hex::FromHex; use crate::constants::{APP_DATA, ERC20_BALANCE, KIND_SELL}; +#[allow(clippy::too_many_arguments)] pub fn get_eip_1271_signature( from_token: Address, to_token: Address, diff --git a/src/ethereum_client.rs b/src/ethereum_client.rs index 882124c..9df03a6 100644 --- a/src/ethereum_client.rs +++ b/src/ethereum_client.rs @@ -66,6 +66,7 @@ impl EthereumClient { .map(|block_num: U64| block_num.try_into().unwrap()) // U64 -> u64 should always work } + #[allow(dead_code)] pub async fn get_chain_timestamp(&self) -> Result { Ok(self.get_latest_block().await?.timestamp.as_u64()) } @@ -234,7 +235,7 @@ mod tests { .await .expect("Unable to get requested swaps"); - assert!(requested_swaps.len() > 0); + assert!(!requested_swaps.is_empty()); } #[test] diff --git a/src/main.rs b/src/main.rs index 1381010..c94662c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -82,7 +82,7 @@ async fn main() { } }; - if requested_swaps.len() > 0 { + if !requested_swaps.is_empty() { info!( "Found {} requested swaps between blocks {} and {}", requested_swaps.len(),