Skip to content

Commit

Permalink
Run cargo clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
imstar15 committed Sep 7, 2024
1 parent 688debf commit 9feb305
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
4 changes: 1 addition & 3 deletions pallets/automation-price/src/fees.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,7 @@ where
Pallet::<T>::calculate_schedule_fee_amount(action)?.saturated_into();

let execution_fee_amount = match action.clone() {
Action::XCMP { execution_fee, instruction_sequence, .. }
if instruction_sequence == InstructionSequence::PayThroughSovereignAccount =>
{
Action::XCMP { execution_fee, instruction_sequence: InstructionSequence::PayThroughSovereignAccount, .. } => {
execution_fee.amount.saturated_into()
},
_ => 0u32.saturated_into(),
Expand Down
6 changes: 2 additions & 4 deletions pallets/automation-price/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -621,8 +621,6 @@ pub mod pallet {
}

for (index, price) in prices.clone().iter().enumerate() {
let index: usize = index.try_into().unwrap();

let chain = chains[index].clone();
let exchange = exchanges[index].clone();
let asset1 = assets1[index].clone();
Expand Down Expand Up @@ -1322,8 +1320,8 @@ pub mod pallet {
);
}

if event.is_some() {
Self::deposit_event(event.unwrap());
if let Some(e) = event {
Self::deposit_event(e);
}
}

Expand Down
9 changes: 5 additions & 4 deletions pallets/automation-price/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,12 +448,13 @@ pub fn get_fee_per_second(location: &Location) -> Option<u128> {
)
.expect("Reanchor location failed");

let found_asset = get_asset_fee_per_second_config().into_iter().find(|item| match item {
MockAssetFeePerSecond { asset_location, .. } => *asset_location == location,
let found_asset = get_asset_fee_per_second_config().into_iter().find(|item| {
let MockAssetFeePerSecond { asset_location, .. } = item;
*asset_location == location
});

if found_asset.is_some() {
Some(found_asset.unwrap().fee_per_second)
if let Some(asset) = found_asset {
Some(asset.fee_per_second)
} else {
None
}
Expand Down
6 changes: 3 additions & 3 deletions pallets/automation-price/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ fn test_sweep_expired_task_works() {

// Now we set timestamp to a later point
Timestamp::set_timestamp(
START_BLOCK_TIME.saturating_add(3_600_000_u64).try_into().unwrap(),
START_BLOCK_TIME.saturating_add(3_600_000_u64),
);

let price_target2 = 1000;
Expand Down Expand Up @@ -776,7 +776,7 @@ fn test_sweep_expired_task_partially() {

// Now we set timestamp to a later point
Timestamp::set_timestamp(
START_BLOCK_TIME.saturating_add((3600 + 6 * 10) * 1000).try_into().unwrap(),
START_BLOCK_TIME.saturating_add((3600 + 6 * 10) * 1000),
);

assert_eq!(
Expand Down Expand Up @@ -1406,7 +1406,7 @@ fn test_expired_task_not_run() {

// Moving the clock to simulate the task expiration
Timestamp::set_timestamp(
START_BLOCK_TIME.saturating_add(7_200_000_u64).try_into().unwrap(),
START_BLOCK_TIME.saturating_add(7_200_000_u64),
);
AutomationPrice::run_tasks(
vec![(task.owner_id.clone(), task.task_id.clone())],
Expand Down

0 comments on commit 9feb305

Please sign in to comment.