From 9ae32d9ef527bce6acfa7d48cd216ca29369beab Mon Sep 17 00:00:00 2001 From: Chralt98 Date: Wed, 18 Dec 2024 15:27:43 +0100 Subject: [PATCH] correct clippy --- zrml/neo-swaps/src/migration.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/zrml/neo-swaps/src/migration.rs b/zrml/neo-swaps/src/migration.rs index f41146a78..c5b02139d 100644 --- a/zrml/neo-swaps/src/migration.rs +++ b/zrml/neo-swaps/src/migration.rs @@ -108,7 +108,7 @@ where storage_key_iter::, OldPoolOf, Twox64Concat>(NEO_SWAPS, POOLS) { total_weight = total_weight.saturating_add(T::DbWeight::get().reads(2)); - if let Err(_) = T::MarketCommons::market(&market_id) { + if T::MarketCommons::market(&market_id).is_err() { log::error!("MigratePoolStorageItems: Market {:?} not found", market_id); return total_weight; }; @@ -257,11 +257,18 @@ mod tests { Asset, Market, MarketCreation, MarketPeriod, MarketStatus, MarketType, ScoringRule, }; + struct RemovableMarketIds; + impl Get> for RemovableMarketIds { + fn get() -> Vec { + vec![] + } + } + #[test] fn on_runtime_upgrade_increments_the_storage_version() { ExtBuilder::default().build().execute_with(|| { set_up_version(); - MigratePoolStorageItems::::on_runtime_upgrade(); + MigratePoolStorageItems::::on_runtime_upgrade(); assert_eq!(StorageVersion::get::>(), NEO_SWAPS_NEXT_STORAGE_VERSION); }); } @@ -275,7 +282,7 @@ mod tests { NEO_SWAPS, POOLS, new_pools, ); let tmp = storage_root(StateVersion::V1); - MigratePoolStorageItems::::on_runtime_upgrade(); + MigratePoolStorageItems::::on_runtime_upgrade(); assert_eq!(tmp, storage_root(StateVersion::V1)); }); } @@ -289,7 +296,7 @@ mod tests { populate_test_data::, OldPoolOf>( NEO_SWAPS, POOLS, old_pools, ); - MigratePoolStorageItems::::on_runtime_upgrade(); + MigratePoolStorageItems::::on_runtime_upgrade(); let actual = Pools::get(0u128).unwrap(); assert_eq!(actual, new_pools[0]); let next_pool_count_id = PoolCount::::get();