Skip to content

Commit ecb7c4b

Browse files
committed
clippy
1 parent 9f93e4c commit ecb7c4b

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

pallets/subtensor/tests/staking.rs

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2315,11 +2315,11 @@ fn test_migrate_remove_zero_stakes() {
23152315
let hotkey1 = U256::from(3);
23162316
let hotkey2 = U256::from(4);
23172317

2318-
Stake::<Test>::insert(&hotkey1, &coldkey1, 0);
2319-
Stake::<Test>::insert(&hotkey2, &coldkey2, 100);
2318+
Stake::<Test>::insert(hotkey1, coldkey1, 0);
2319+
Stake::<Test>::insert(hotkey2, coldkey2, 100);
23202320

2321-
assert_eq!(Stake::<Test>::get(&hotkey1, &coldkey1), 0);
2322-
assert_eq!(Stake::<Test>::get(&hotkey2, &coldkey2), 100);
2321+
assert_eq!(Stake::<Test>::get(hotkey1, coldkey1), 0);
2322+
assert_eq!(Stake::<Test>::get(hotkey2, coldkey2), 100);
23232323

23242324
assert!(!HasMigrationRun::<Test>::get(
23252325
b"remove_zero_stakes_v1".to_vec()
@@ -2334,11 +2334,11 @@ fn test_migrate_remove_zero_stakes() {
23342334
b"remove_zero_stakes_v1".to_vec()
23352335
));
23362336

2337-
assert_eq!(Stake::<Test>::get(&hotkey1, &coldkey1), 0); // Default is 0
2338-
assert!(!Stake::<Test>::contains_key(&hotkey1, &coldkey1));
2337+
assert_eq!(Stake::<Test>::get(hotkey1, coldkey1), 0); // Default is 0
2338+
assert!(!Stake::<Test>::contains_key(hotkey1, coldkey1));
23392339

2340-
assert_eq!(Stake::<Test>::get(&hotkey2, &coldkey2), 100);
2341-
assert!(Stake::<Test>::contains_key(&hotkey2, &coldkey2));
2340+
assert_eq!(Stake::<Test>::get(hotkey2, coldkey2), 100);
2341+
assert!(Stake::<Test>::contains_key(hotkey2, coldkey2));
23422342

23432343
assert!(
23442344
weight != Weight::zero(),
@@ -2353,16 +2353,16 @@ fn test_decrease_stake_non_zero_stake() {
23532353
let hotkey = U256::from(1);
23542354
let coldkey = U256::from(2);
23552355

2356-
TotalColdkeyStake::<Test>::insert(&coldkey, 200);
2357-
TotalHotkeyStake::<Test>::insert(&hotkey, 150);
2358-
Stake::<Test>::insert(&hotkey, &coldkey, 100);
2356+
TotalColdkeyStake::<Test>::insert(coldkey, 200);
2357+
TotalHotkeyStake::<Test>::insert(hotkey, 150);
2358+
Stake::<Test>::insert(hotkey, coldkey, 100);
23592359
TotalStake::<Test>::put(300);
23602360

23612361
SubtensorModule::decrease_stake_on_coldkey_hotkey_account(&coldkey, &hotkey, 50);
23622362

2363-
assert_eq!(TotalColdkeyStake::<Test>::get(&coldkey), 150);
2364-
assert_eq!(TotalHotkeyStake::<Test>::get(&hotkey), 100);
2365-
assert_eq!(Stake::<Test>::get(&hotkey, &coldkey), 50);
2363+
assert_eq!(TotalColdkeyStake::<Test>::get(coldkey), 150);
2364+
assert_eq!(TotalHotkeyStake::<Test>::get(hotkey), 100);
2365+
assert_eq!(Stake::<Test>::get(hotkey, coldkey), 50);
23662366
assert_eq!(TotalStake::<Test>::get(), 250);
23672367
});
23682368
}
@@ -2374,18 +2374,18 @@ fn test_decrease_stake_to_zero() {
23742374
let coldkey = U256::from(2);
23752375

23762376
// Insert initial stake
2377-
TotalColdkeyStake::<Test>::insert(&coldkey, 150);
2378-
TotalHotkeyStake::<Test>::insert(&hotkey, 100);
2379-
Stake::<Test>::insert(&hotkey, &coldkey, 50);
2377+
TotalColdkeyStake::<Test>::insert(coldkey, 150);
2378+
TotalHotkeyStake::<Test>::insert(hotkey, 100);
2379+
Stake::<Test>::insert(hotkey, coldkey, 50);
23802380
TotalStake::<Test>::put(250);
23812381

23822382
// Decrease stake to zero
23832383
SubtensorModule::decrease_stake_on_coldkey_hotkey_account(&coldkey, &hotkey, 50);
23842384

23852385
// Check that the stake is removed
2386-
assert_eq!(TotalColdkeyStake::<Test>::get(&coldkey), 100);
2387-
assert_eq!(TotalHotkeyStake::<Test>::get(&hotkey), 50);
2388-
assert!(!Stake::<Test>::contains_key(&hotkey, &coldkey));
2386+
assert_eq!(TotalColdkeyStake::<Test>::get(coldkey), 100);
2387+
assert_eq!(TotalHotkeyStake::<Test>::get(hotkey), 50);
2388+
assert!(!Stake::<Test>::contains_key(hotkey, coldkey));
23892389
assert_eq!(TotalStake::<Test>::get(), 200);
23902390
});
23912391
}
@@ -2397,18 +2397,18 @@ fn test_decrease_stake_more_than_available() {
23972397
let coldkey = U256::from(2);
23982398

23992399
// Insert initial stake
2400-
TotalColdkeyStake::<Test>::insert(&coldkey, 80);
2401-
TotalHotkeyStake::<Test>::insert(&hotkey, 70);
2402-
Stake::<Test>::insert(&hotkey, &coldkey, 60);
2400+
TotalColdkeyStake::<Test>::insert(coldkey, 80);
2401+
TotalHotkeyStake::<Test>::insert(hotkey, 70);
2402+
Stake::<Test>::insert(hotkey, coldkey, 60);
24032403
TotalStake::<Test>::put(150);
24042404

24052405
// Decrease by more than available stake
24062406
SubtensorModule::decrease_stake_on_coldkey_hotkey_account(&coldkey, &hotkey, 100);
24072407

24082408
// Check that the stake is zero and removed
2409-
assert_eq!(TotalColdkeyStake::<Test>::get(&coldkey), 0);
2410-
assert_eq!(TotalHotkeyStake::<Test>::get(&hotkey), 0);
2411-
assert!(!Stake::<Test>::contains_key(&hotkey, &coldkey));
2409+
assert_eq!(TotalColdkeyStake::<Test>::get(coldkey), 0);
2410+
assert_eq!(TotalHotkeyStake::<Test>::get(hotkey), 0);
2411+
assert!(!Stake::<Test>::contains_key(hotkey, coldkey));
24122412
assert_eq!(TotalStake::<Test>::get(), 50);
24132413
});
24142414
}
@@ -2420,18 +2420,18 @@ fn test_decrease_stake_no_existing_stake() {
24202420
let coldkey = U256::from(2);
24212421

24222422
// Insert zero stake for coldkey and hotkey
2423-
TotalColdkeyStake::<Test>::insert(&coldkey, 0);
2424-
TotalHotkeyStake::<Test>::insert(&hotkey, 0);
2425-
Stake::<Test>::remove(&hotkey, &coldkey);
2423+
TotalColdkeyStake::<Test>::insert(coldkey, 0);
2424+
TotalHotkeyStake::<Test>::insert(hotkey, 0);
2425+
Stake::<Test>::remove(hotkey, coldkey);
24262426
TotalStake::<Test>::put(0);
24272427

24282428
// Try to decrease stake when no stake exists
24292429
SubtensorModule::decrease_stake_on_coldkey_hotkey_account(&coldkey, &hotkey, 10);
24302430

24312431
// Assert no changes were made
2432-
assert_eq!(TotalColdkeyStake::<Test>::get(&coldkey), 0);
2433-
assert_eq!(TotalHotkeyStake::<Test>::get(&hotkey), 0);
2434-
assert!(!Stake::<Test>::contains_key(&hotkey, &coldkey));
2432+
assert_eq!(TotalColdkeyStake::<Test>::get(coldkey), 0);
2433+
assert_eq!(TotalHotkeyStake::<Test>::get(hotkey), 0);
2434+
assert!(!Stake::<Test>::contains_key(hotkey, coldkey));
24352435
assert_eq!(TotalStake::<Test>::get(), 0);
24362436
});
24372437
}

0 commit comments

Comments
 (0)