From 0622c9974a43676e559df3a134cad69e779346e8 Mon Sep 17 00:00:00 2001 From: Kyrylo Stepanov Date: Fri, 15 Nov 2024 18:00:41 +0200 Subject: [PATCH] Satisfy clippy --- nft_ingester/src/bin/synchronizer/main.rs | 6 +++--- rocks-db/src/batch_client.rs | 22 ++++------------------ 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/nft_ingester/src/bin/synchronizer/main.rs b/nft_ingester/src/bin/synchronizer/main.rs index 7e679b3e..2cfe7be3 100644 --- a/nft_ingester/src/bin/synchronizer/main.rs +++ b/nft_ingester/src/bin/synchronizer/main.rs @@ -127,7 +127,7 @@ pub async fn main() -> Result<(), IngesterError> { } let asset_types = [AssetType::Fungible, AssetType::NonFungible]; - for asset_type in asset_types.clone().into_iter() { + for asset_type in asset_types.into_iter() { let synchronizer = synchronizer.clone(); let shutdown_rx = shutdown_rx.resubscribe(); @@ -150,7 +150,7 @@ pub async fn main() -> Result<(), IngesterError> { Ok(()) }); } - while let Some(_) = mutexed_tasks.lock().await.join_next().await {} + while (mutexed_tasks.lock().await.join_next().await).is_some() {} let shutdown_rx_clone = shutdown_rx.resubscribe(); let synchronizer_clone = synchronizer.clone(); @@ -202,7 +202,7 @@ pub async fn main() -> Result<(), IngesterError> { Ok(()) }); - while let Some(_) = mutexed_tasks.lock().await.join_next().await {} + while (mutexed_tasks.lock().await.join_next().await).is_some() {} Ok(()) } diff --git a/rocks-db/src/batch_client.rs b/rocks-db/src/batch_client.rs index ee0eea67..b0215b13 100644 --- a/rocks-db/src/batch_client.rs +++ b/rocks-db/src/batch_client.rs @@ -89,15 +89,8 @@ impl AssetUpdateIndexStorage for Storage { None => self.fungible_assets_update_idx.iter_start(), }; - let up_to = if let Some(up_to_key) = up_to { - Some(encode_u64x2_pubkey( - up_to_key.seq, - up_to_key.slot, - up_to_key.pubkey, - )) - } else { - None - }; + let up_to = up_to + .map(|up_to_key| encode_u64x2_pubkey(up_to_key.seq, up_to_key.slot, up_to_key.pubkey)); for pair in iterator { let (idx_key, _) = pair?; @@ -156,15 +149,8 @@ impl AssetUpdateIndexStorage for Storage { None => self.assets_update_idx.iter_start(), }; - let up_to = if let Some(up_to_key) = up_to { - Some(encode_u64x2_pubkey( - up_to_key.seq, - up_to_key.slot, - up_to_key.pubkey, - )) - } else { - None - }; + let up_to = up_to + .map(|up_to_key| encode_u64x2_pubkey(up_to_key.seq, up_to_key.slot, up_to_key.pubkey)); for pair in iterator { let (idx_key, _) = pair?;