From ecb7c4b43a3f86df4f591b6fd67393ac1cea93e8 Mon Sep 17 00:00:00 2001 From: johnreedv Date: Thu, 12 Sep 2024 09:06:22 -0700 Subject: [PATCH] clippy --- pallets/subtensor/tests/staking.rs | 64 +++++++++++++++--------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/pallets/subtensor/tests/staking.rs b/pallets/subtensor/tests/staking.rs index 297e51a96..07df75292 100644 --- a/pallets/subtensor/tests/staking.rs +++ b/pallets/subtensor/tests/staking.rs @@ -2315,11 +2315,11 @@ fn test_migrate_remove_zero_stakes() { let hotkey1 = U256::from(3); let hotkey2 = U256::from(4); - Stake::::insert(&hotkey1, &coldkey1, 0); - Stake::::insert(&hotkey2, &coldkey2, 100); + Stake::::insert(hotkey1, coldkey1, 0); + Stake::::insert(hotkey2, coldkey2, 100); - assert_eq!(Stake::::get(&hotkey1, &coldkey1), 0); - assert_eq!(Stake::::get(&hotkey2, &coldkey2), 100); + assert_eq!(Stake::::get(hotkey1, coldkey1), 0); + assert_eq!(Stake::::get(hotkey2, coldkey2), 100); assert!(!HasMigrationRun::::get( b"remove_zero_stakes_v1".to_vec() @@ -2334,11 +2334,11 @@ fn test_migrate_remove_zero_stakes() { b"remove_zero_stakes_v1".to_vec() )); - assert_eq!(Stake::::get(&hotkey1, &coldkey1), 0); // Default is 0 - assert!(!Stake::::contains_key(&hotkey1, &coldkey1)); + assert_eq!(Stake::::get(hotkey1, coldkey1), 0); // Default is 0 + assert!(!Stake::::contains_key(hotkey1, coldkey1)); - assert_eq!(Stake::::get(&hotkey2, &coldkey2), 100); - assert!(Stake::::contains_key(&hotkey2, &coldkey2)); + assert_eq!(Stake::::get(hotkey2, coldkey2), 100); + assert!(Stake::::contains_key(hotkey2, coldkey2)); assert!( weight != Weight::zero(), @@ -2353,16 +2353,16 @@ fn test_decrease_stake_non_zero_stake() { let hotkey = U256::from(1); let coldkey = U256::from(2); - TotalColdkeyStake::::insert(&coldkey, 200); - TotalHotkeyStake::::insert(&hotkey, 150); - Stake::::insert(&hotkey, &coldkey, 100); + TotalColdkeyStake::::insert(coldkey, 200); + TotalHotkeyStake::::insert(hotkey, 150); + Stake::::insert(hotkey, coldkey, 100); TotalStake::::put(300); SubtensorModule::decrease_stake_on_coldkey_hotkey_account(&coldkey, &hotkey, 50); - assert_eq!(TotalColdkeyStake::::get(&coldkey), 150); - assert_eq!(TotalHotkeyStake::::get(&hotkey), 100); - assert_eq!(Stake::::get(&hotkey, &coldkey), 50); + assert_eq!(TotalColdkeyStake::::get(coldkey), 150); + assert_eq!(TotalHotkeyStake::::get(hotkey), 100); + assert_eq!(Stake::::get(hotkey, coldkey), 50); assert_eq!(TotalStake::::get(), 250); }); } @@ -2374,18 +2374,18 @@ fn test_decrease_stake_to_zero() { let coldkey = U256::from(2); // Insert initial stake - TotalColdkeyStake::::insert(&coldkey, 150); - TotalHotkeyStake::::insert(&hotkey, 100); - Stake::::insert(&hotkey, &coldkey, 50); + TotalColdkeyStake::::insert(coldkey, 150); + TotalHotkeyStake::::insert(hotkey, 100); + Stake::::insert(hotkey, coldkey, 50); TotalStake::::put(250); // Decrease stake to zero SubtensorModule::decrease_stake_on_coldkey_hotkey_account(&coldkey, &hotkey, 50); // Check that the stake is removed - assert_eq!(TotalColdkeyStake::::get(&coldkey), 100); - assert_eq!(TotalHotkeyStake::::get(&hotkey), 50); - assert!(!Stake::::contains_key(&hotkey, &coldkey)); + assert_eq!(TotalColdkeyStake::::get(coldkey), 100); + assert_eq!(TotalHotkeyStake::::get(hotkey), 50); + assert!(!Stake::::contains_key(hotkey, coldkey)); assert_eq!(TotalStake::::get(), 200); }); } @@ -2397,18 +2397,18 @@ fn test_decrease_stake_more_than_available() { let coldkey = U256::from(2); // Insert initial stake - TotalColdkeyStake::::insert(&coldkey, 80); - TotalHotkeyStake::::insert(&hotkey, 70); - Stake::::insert(&hotkey, &coldkey, 60); + TotalColdkeyStake::::insert(coldkey, 80); + TotalHotkeyStake::::insert(hotkey, 70); + Stake::::insert(hotkey, coldkey, 60); TotalStake::::put(150); // Decrease by more than available stake SubtensorModule::decrease_stake_on_coldkey_hotkey_account(&coldkey, &hotkey, 100); // Check that the stake is zero and removed - assert_eq!(TotalColdkeyStake::::get(&coldkey), 0); - assert_eq!(TotalHotkeyStake::::get(&hotkey), 0); - assert!(!Stake::::contains_key(&hotkey, &coldkey)); + assert_eq!(TotalColdkeyStake::::get(coldkey), 0); + assert_eq!(TotalHotkeyStake::::get(hotkey), 0); + assert!(!Stake::::contains_key(hotkey, coldkey)); assert_eq!(TotalStake::::get(), 50); }); } @@ -2420,18 +2420,18 @@ fn test_decrease_stake_no_existing_stake() { let coldkey = U256::from(2); // Insert zero stake for coldkey and hotkey - TotalColdkeyStake::::insert(&coldkey, 0); - TotalHotkeyStake::::insert(&hotkey, 0); - Stake::::remove(&hotkey, &coldkey); + TotalColdkeyStake::::insert(coldkey, 0); + TotalHotkeyStake::::insert(hotkey, 0); + Stake::::remove(hotkey, coldkey); TotalStake::::put(0); // Try to decrease stake when no stake exists SubtensorModule::decrease_stake_on_coldkey_hotkey_account(&coldkey, &hotkey, 10); // Assert no changes were made - assert_eq!(TotalColdkeyStake::::get(&coldkey), 0); - assert_eq!(TotalHotkeyStake::::get(&hotkey), 0); - assert!(!Stake::::contains_key(&hotkey, &coldkey)); + assert_eq!(TotalColdkeyStake::::get(coldkey), 0); + assert_eq!(TotalHotkeyStake::::get(hotkey), 0); + assert!(!Stake::::contains_key(hotkey, coldkey)); assert_eq!(TotalStake::::get(), 0); }); }