Skip to content

Commit f603944

Browse files
authored
Merge pull request #718 from opentensor/fix-collapsible-match-clippy
fix clippy
2 parents 88f6b57 + 4734542 commit f603944

File tree

10 files changed

+14
-21
lines changed

10 files changed

+14
-21
lines changed

Diff for: pallets/subtensor/src/lib.rs

+8-9
Original file line numberDiff line numberDiff line change
@@ -2403,18 +2403,17 @@ where
24032403
_len: usize,
24042404
) -> TransactionValidity {
24052405
// Check if the call is one of the balance transfer types we want to reject
2406-
if let Some(balances_call) = call.is_sub_type() {
2407-
match balances_call {
2408-
BalancesCall::transfer_allow_death { .. }
2409-
| BalancesCall::transfer_keep_alive { .. }
2410-
| BalancesCall::transfer_all { .. } => {
2411-
if Pallet::<T>::coldkey_in_arbitration(who) {
2412-
return Err(TransactionValidityError::Invalid(InvalidTransaction::Call));
2413-
}
2406+
match call.is_sub_type() {
2407+
Some(BalancesCall::transfer_allow_death { .. })
2408+
| Some(BalancesCall::transfer_keep_alive { .. })
2409+
| Some(BalancesCall::transfer_all { .. }) => {
2410+
if Pallet::<T>::coldkey_in_arbitration(who) {
2411+
return Err(TransactionValidityError::Invalid(InvalidTransaction::Call));
24142412
}
2415-
_ => {} // Other Balances calls are allowed
24162413
}
2414+
_ => {} // Other Balances calls are allowed
24172415
}
2416+
24182417
match call.is_sub_type() {
24192418
Some(Call::commit_weights { netuid, .. }) => {
24202419
if Self::check_weights_min_stake(who) {

Diff for: pallets/subtensor/tests/difficulty.rs

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ mod mock;
55
use sp_core::U256;
66

77
#[test]
8-
#[cfg(not(tarpaulin))]
98
fn test_registration_difficulty_adjustment() {
109
new_test_ext(1).execute_with(|| {
1110
// Create Net 1

Diff for: pallets/subtensor/tests/epoch.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2107,7 +2107,6 @@ fn test_zero_weights() {
21072107

21082108
// Test that epoch assigns validator permits to highest stake uids, varies uid interleaving and stake values.
21092109
#[test]
2110-
#[cfg(not(tarpaulin))]
21112110
fn test_validator_permits() {
21122111
let netuid: u16 = 1;
21132112
let tempo: u16 = u16::MAX - 1; // high tempo to skip automatic epochs in on_initialize, use manual epochs instead

Diff for: pallets/subtensor/tests/mock.rs

+4
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ impl CollectiveInterface<AccountId, H256, u32> for TriumvirateVotes {
262262
}
263263

264264
// We call pallet_collective TriumvirateCollective
265+
#[allow(unused)]
265266
type TriumvirateCollective = pallet_collective::Instance1;
266267
impl pallet_collective::Config<TriumvirateCollective> for Test {
267268
type RuntimeOrigin = RuntimeOrigin;
@@ -279,6 +280,7 @@ impl pallet_collective::Config<TriumvirateCollective> for Test {
279280
}
280281

281282
// We call council members Triumvirate
283+
#[allow(unused)]
282284
type TriumvirateMembership = pallet_membership::Instance1;
283285
impl pallet_membership::Config<TriumvirateMembership> for Test {
284286
type RuntimeEvent = RuntimeEvent;
@@ -295,6 +297,7 @@ impl pallet_membership::Config<TriumvirateMembership> for Test {
295297

296298
// This is a dummy collective instance for managing senate members
297299
// Probably not the best solution, but fastest implementation
300+
#[allow(unused)]
298301
type SenateCollective = pallet_collective::Instance2;
299302
impl pallet_collective::Config<SenateCollective> for Test {
300303
type RuntimeOrigin = RuntimeOrigin;
@@ -312,6 +315,7 @@ impl pallet_collective::Config<SenateCollective> for Test {
312315
}
313316

314317
// We call our top K delegates membership Senate
318+
#[allow(unused)]
315319
type SenateMembership = pallet_membership::Instance2;
316320
impl pallet_membership::Config<SenateMembership> for Test {
317321
type RuntimeEvent = RuntimeEvent;

Diff for: pallets/subtensor/tests/neuron_info.rs

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ fn test_get_neuron_none() {
1515
}
1616

1717
#[test]
18-
#[cfg(not(tarpaulin))]
1918
fn test_get_neuron_some() {
2019
new_test_ext(1).execute_with(|| {
2120
let netuid: u16 = 1;

Diff for: pallets/subtensor/tests/registration.rs

-1
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,6 @@ fn test_burn_adjustment() {
539539
}
540540

541541
#[test]
542-
#[cfg(not(tarpaulin))]
543542
fn test_registration_too_many_registrations_per_block() {
544543
new_test_ext(1).execute_with(|| {
545544
let netuid: u16 = 1;

Diff for: pallets/subtensor/tests/serving.rs

-2
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ fn test_serving_set_metadata_update() {
161161
}
162162

163163
#[test]
164-
#[cfg(not(tarpaulin))]
165164
fn test_axon_serving_rate_limit_exceeded() {
166165
new_test_ext(1).execute_with(|| {
167166
let hotkey_account_id = U256::from(1);
@@ -379,7 +378,6 @@ fn test_prometheus_serving_set_metadata_update() {
379378
}
380379

381380
#[test]
382-
#[cfg(not(tarpaulin))]
383381
fn test_prometheus_serving_rate_limit_exceeded() {
384382
new_test_ext(1).execute_with(|| {
385383
let hotkey_account_id = U256::from(1);

Diff for: pallets/subtensor/tests/staking.rs

-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ use sp_runtime::traits::SignedExtension;
2222
************************************************************/
2323

2424
#[test]
25-
#[cfg(not(tarpaulin))]
2625
fn test_add_stake_dispatch_info_ok() {
2726
new_test_ext(1).execute_with(|| {
2827
let hotkey = U256::from(0);
@@ -528,7 +527,6 @@ fn test_remove_stake_rate_limit_exceeded() {
528527
}
529528

530529
#[test]
531-
#[cfg(not(tarpaulin))]
532530
fn test_remove_stake_dispatch_info_ok() {
533531
new_test_ext(1).execute_with(|| {
534532
let hotkey = U256::from(0);
@@ -1201,7 +1199,6 @@ fn test_delegate_stake_division_by_zero_check() {
12011199
}
12021200

12031201
#[test]
1204-
#[cfg(not(tarpaulin))]
12051202
fn test_full_with_delegating() {
12061203
new_test_ext(1).execute_with(|| {
12071204
let netuid = 1;

Diff for: pallets/subtensor/tests/weights.rs

-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use substrate_fixed::types::I32F32;
2121

2222
// Test the call passes through the subtensor module.
2323
#[test]
24-
#[cfg(not(tarpaulin))]
2524
fn test_set_weights_dispatch_info_ok() {
2625
new_test_ext(0).execute_with(|| {
2726
let dests = vec![1, 1];
@@ -41,7 +40,6 @@ fn test_set_weights_dispatch_info_ok() {
4140
});
4241
}
4342
#[test]
44-
#[cfg(not(tarpaulin))]
4543
fn test_set_rootweights_dispatch_info_ok() {
4644
new_test_ext(0).execute_with(|| {
4745
let dests = vec![1, 1];
@@ -404,7 +402,6 @@ fn test_weights_err_no_validator_permit() {
404402

405403
// To execute this test: cargo test --package pallet-subtensor --test weights test_set_weights_min_stake_failed -- --nocapture`
406404
#[test]
407-
#[cfg(not(tarpaulin))]
408405
fn test_set_weights_min_stake_failed() {
409406
new_test_ext(0).execute_with(|| {
410407
let dests = vec![0];

Diff for: runtime/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,7 @@ impl pallet_collective::Config<TriumvirateCollective> for Runtime {
516516
}
517517

518518
// We call council members Triumvirate
519+
#[allow(unused)]
519520
type TriumvirateMembership = pallet_membership::Instance1;
520521
impl pallet_membership::Config<TriumvirateMembership> for Runtime {
521522
type RuntimeEvent = RuntimeEvent;
@@ -531,6 +532,7 @@ impl pallet_membership::Config<TriumvirateMembership> for Runtime {
531532
}
532533

533534
// We call our top K delegates membership Senate
535+
#[allow(unused)]
534536
type SenateMembership = pallet_membership::Instance2;
535537
impl pallet_membership::Config<SenateMembership> for Runtime {
536538
type RuntimeEvent = RuntimeEvent;

0 commit comments

Comments
 (0)