Skip to content

Commit

Permalink
fix: clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
shekohex committed Feb 10, 2025
1 parent c6feb10 commit 0fe6a28
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pallets/multi-asset-delegation/src/functions/delegate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ impl<T: Config> Pallet<T> {
delegation.asset_id == Asset::Custom(Zero::zero()),
Error::<T>::AssetNotWhitelisted
);
Ok(Some((index, delegation.amount.clone())))
Ok(Some((index, delegation.amount)))
} else {
Ok(None)
}
Expand Down
2 changes: 1 addition & 1 deletion pallets/multi-asset-delegation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ pub mod pallet {
use scale_info::TypeInfo;
use sp_core::H160;
use sp_runtime::traits::{MaybeSerializeDeserialize, Member, Zero};
use sp_staking::{OnStakingUpdate, SessionIndex, Stake, StakingInterface};
use sp_staking::{SessionIndex, StakingInterface};
use sp_std::{fmt::Debug, prelude::*, vec::Vec};
use tangle_primitives::traits::RewardsManager;
use tangle_primitives::types::rewards::LockMultiplier;
Expand Down
9 changes: 6 additions & 3 deletions pallets/multi-asset-delegation/src/tests/delegate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,15 +555,18 @@ fn delegate_should_not_create_multiple_on_repeat_delegation() {
fn delegate_exceeds_max_delegations() {
new_test_ext().execute_with(|| {
let who: AccountId = Bob.into();
let operator: AccountId = Alice.into();
let amount = 100;

// Setup max number of operators
let mut operators = vec![];
for i in 0..MaxDelegations::get() {
let operator_account: AccountId = AccountId::new([i as u8; 32]);
// Give operator enough balance to join
Balances::force_set_balance(RuntimeOrigin::root(), operator_account.clone(), 100_000);
assert_ok!(Balances::force_set_balance(
RuntimeOrigin::root(),
operator_account.clone(),
100_000
));
operators.push(operator_account.clone());
assert_ok!(MultiAssetDelegation::join_operators(
RuntimeOrigin::signed(operator_account),
Expand Down Expand Up @@ -595,7 +598,7 @@ fn delegate_exceeds_max_delegations() {

let operator: AccountId = Charlie.into();
// Give operator enough balance to join
Balances::force_set_balance(RuntimeOrigin::root(), operator.clone(), 100_000);
assert_ok!(Balances::force_set_balance(RuntimeOrigin::root(), operator.clone(), 100_000));
assert_ok!(MultiAssetDelegation::join_operators(
RuntimeOrigin::signed(operator.clone()),
10_000
Expand Down
6 changes: 3 additions & 3 deletions pallets/services/src/functions/register.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@ impl<T: Config> Pallet<T> {
let (_, blueprint) = Self::blueprints(blueprint_id)?;

ensure!(
T::OperatorDelegationManager::is_operator_active(&operator),
T::OperatorDelegationManager::is_operator_active(operator),
Error::<T>::OperatorNotActive
);

let already_registered = Operators::<T>::contains_key(blueprint_id, &operator);
let already_registered = Operators::<T>::contains_key(blueprint_id, operator);
ensure!(!already_registered, Error::<T>::AlreadyRegistered);
blueprint
.type_check_registration(&registration_args)
.map_err(Error::<T>::TypeCheck)?;

// Transfer the registration value to the pallet
T::Currency::transfer(
&operator,
operator,
&Self::pallet_account(),
value,
ExistenceRequirement::KeepAlive,
Expand Down
2 changes: 1 addition & 1 deletion runtime/testnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ where
);
let raw_payload = SignedPayload::new(call, extra)
.map_err(|e| {
log::warn!("Unable to create signed payload: {:?}", e);
log::warn!("Unable to create signed payload: {e}");
})
.ok()?;
let signature = raw_payload.using_encoded(|payload| C::sign(payload, public))?;
Expand Down

0 comments on commit 0fe6a28

Please sign in to comment.