Skip to content

Commit

Permalink
change: make clippy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
pandres95 committed Nov 19, 2024
1 parent 0ac7af8 commit c4d994a
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 38 deletions.
10 changes: 4 additions & 6 deletions pallets/pass/src/extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ where
post_info: &sp_runtime::traits::PostDispatchInfoOf<Self::Call>,
len: usize,
result: &sp_runtime::DispatchResult,
) -> Result<(), frame_support::pallet_prelude::TransactionValidityError> {
) -> Result<(), TransactionValidityError> {
S::post_dispatch(pre, info, post_info, len, result)
}
}
Expand Down Expand Up @@ -180,7 +180,7 @@ where
if Pallet::<T, I>::signer_from_session_key(who).is_some() {
return Ok(Default::default());
}
self.0.validate(&who, call, info, len)
self.0.validate(who, call, info, len)
}

fn pre_dispatch(
Expand All @@ -194,9 +194,7 @@ where
return Ok(None);
}

self.0
.pre_dispatch(&who, call, info, len)
.map(|pre| Some(pre))
self.0.pre_dispatch(who, call, info, len).map(Some)
}

fn post_dispatch(
Expand All @@ -205,7 +203,7 @@ where
post_info: &sp_runtime::traits::PostDispatchInfoOf<Self::Call>,
len: usize,
result: &sp_runtime::DispatchResult,
) -> Result<(), frame_support::pallet_prelude::TransactionValidityError> {
) -> Result<(), TransactionValidityError> {
if let Some(Some(pre)) = pre {
S::post_dispatch(Some(pre), info, post_info, len, result)
} else {
Expand Down
17 changes: 7 additions & 10 deletions pallets/referenda-tracks/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,13 @@ impl<Class> VoteTally<u32, Class> for Tally {
fn setup(_: Class, _: Perbill) {}
}

pub fn new_test_ext(
maybe_tracks: Option<
Vec<(
TrackIdOf<Test, ()>,
TrackInfoOf<Test, ()>,
PalletsOriginOf<Test>,
)>,
>,
) -> sp_io::TestExternalities {
type TracksVec = Vec<(
TrackIdOf<Test, ()>,
TrackInfoOf<Test, ()>,
PalletsOriginOf<Test>,
)>;

pub fn new_test_ext(maybe_tracks: Option<TracksVec>) -> sp_io::TestExternalities {
let balances = vec![(1, 100), (2, 100), (3, 100), (4, 100), (5, 100), (6, 100)];

let t = RuntimeGenesisConfig {
Expand All @@ -220,7 +218,6 @@ pub fn new_test_ext(
}

System::reset_events();
} else {
}
});

Expand Down
4 changes: 2 additions & 2 deletions traits/authn/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ pub mod dummy {

impl<A> Clone for DummyAttestation<A> {
fn clone(&self) -> Self {
Self(self.0.clone(), PhantomData)
Self(self.0, PhantomData)
}
}

Expand All @@ -178,7 +178,7 @@ pub mod dummy {

impl<A> Clone for DummyCredential<A> {
fn clone(&self) -> Self {
Self(self.0.clone(), PhantomData)
Self(self.0, PhantomData)
}
}

Expand Down
33 changes: 15 additions & 18 deletions traits/gas-tank/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,11 @@ mod gas_burner {
fn it_works_returning_which_item_was_used_to_burn_gas() {
new_test_ext().execute_with(|| {
// Assert "small" tank membership
let Some(remaining) = MembershipsGas::check_available_gas(
let remaining = MembershipsGas::check_available_gas(
&SmallMember::get(),
&<() as frame_system::WeightInfo>::remark(100),
) else {
return assert!(false);
};
)
.expect("gas to burn equals tank capacity; qed");

assert_eq!(
MembershipsGas::burn_gas(
Expand All @@ -207,35 +206,33 @@ mod gas_burner {
);

// Assert "medium" tank membership
let Some(remaining) = MembershipsGas::check_available_gas(
let remaining = MembershipsGas::check_available_gas(
&MediumMember::get(),
&<() as frame_system::WeightInfo>::remark(100),
) else {
return assert!(false);
};
&<() as frame_system::WeightInfo>::remark(1000),
)
.expect("gas to burn equals tank capacity; qed");

assert_eq!(
MembershipsGas::burn_gas(
&SmallMember::get(),
&MediumMember::get(),
&remaining,
&<() as frame_system::WeightInfo>::remark(100)
&<() as frame_system::WeightInfo>::remark(1000)
),
Weight::zero()
);

// Assert "large" tank membership
let Some(remaining) = MembershipsGas::check_available_gas(
let remaining = MembershipsGas::check_available_gas(
&LargeMember::get(),
&<() as frame_system::WeightInfo>::remark(1000),
) else {
return assert!(false);
};
&<() as frame_system::WeightInfo>::remark(10000),
)
.expect("gas to burn equals tank capacity; qed");

assert_eq!(
MembershipsGas::burn_gas(
&SmallMember::get(),
&LargeMember::get(),
&remaining,
&<() as frame_system::WeightInfo>::remark(1000)
&<() as frame_system::WeightInfo>::remark(10000)
),
Weight::zero()
);
Expand Down
2 changes: 0 additions & 2 deletions traits/memberships/src/tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use super::*;

use frame_support::{
assert_ok, construct_runtime, derive_impl, parameter_types,
traits::{AsEnsureOriginWithArg, ConstU128, ConstU32},
Expand Down

0 comments on commit c4d994a

Please sign in to comment.