mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 20:11:09 +00:00
Fix clippy lints behind feature gates and add new CI step all features (#2569)
Many clippy lints usually enforced by `-Dcomplexity` and `-Dcorrectness` are not caught by CI as they are gated by `features`, like `runtime-benchmarks`, while the clippy CI job runs with only the default features for all targets. This PR also adds a CI step to run clippy with `--all-features` to ensure the code quality is maintained behind feature gates from now on. To improve local development, clippy lints are downgraded to warnings, but they still will result in an error at CI due to the `-Dwarnings` rustflag. --------- Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>
This commit is contained in:
@@ -183,7 +183,7 @@ mod benchmarks {
|
||||
let voter = &members[j as usize];
|
||||
Alliance::<T, I>::vote(
|
||||
SystemOrigin::Signed(voter.clone()).into(),
|
||||
last_hash.clone(),
|
||||
last_hash,
|
||||
index,
|
||||
true,
|
||||
)?;
|
||||
@@ -191,12 +191,7 @@ mod benchmarks {
|
||||
|
||||
let voter = members[m as usize - 3].clone();
|
||||
// Voter votes aye without resolving the vote.
|
||||
Alliance::<T, I>::vote(
|
||||
SystemOrigin::Signed(voter.clone()).into(),
|
||||
last_hash.clone(),
|
||||
index,
|
||||
true,
|
||||
)?;
|
||||
Alliance::<T, I>::vote(SystemOrigin::Signed(voter.clone()).into(), last_hash, index, true)?;
|
||||
|
||||
// Voter switches vote to nay, but does not kill the vote, just updates + inserts
|
||||
let approve = false;
|
||||
@@ -206,7 +201,7 @@ mod benchmarks {
|
||||
frame_benchmarking::benchmarking::add_to_whitelist(voter_key.into());
|
||||
|
||||
#[extrinsic_call]
|
||||
_(SystemOrigin::Signed(voter), last_hash.clone(), index, approve);
|
||||
_(SystemOrigin::Signed(voter), last_hash, index, approve);
|
||||
|
||||
//nothing to verify
|
||||
Ok(())
|
||||
@@ -255,24 +250,19 @@ mod benchmarks {
|
||||
let voter = &members[j as usize];
|
||||
Alliance::<T, I>::vote(
|
||||
SystemOrigin::Signed(voter.clone()).into(),
|
||||
last_hash.clone(),
|
||||
last_hash,
|
||||
index,
|
||||
true,
|
||||
)?;
|
||||
}
|
||||
|
||||
// Voter votes aye without resolving the vote.
|
||||
Alliance::<T, I>::vote(
|
||||
SystemOrigin::Signed(voter.clone()).into(),
|
||||
last_hash.clone(),
|
||||
index,
|
||||
true,
|
||||
)?;
|
||||
Alliance::<T, I>::vote(SystemOrigin::Signed(voter.clone()).into(), last_hash, index, true)?;
|
||||
|
||||
// Voter switches vote to nay, which kills the vote
|
||||
Alliance::<T, I>::vote(
|
||||
SystemOrigin::Signed(voter.clone()).into(),
|
||||
last_hash.clone(),
|
||||
last_hash,
|
||||
index,
|
||||
false,
|
||||
)?;
|
||||
@@ -282,7 +272,7 @@ mod benchmarks {
|
||||
frame_benchmarking::benchmarking::add_to_whitelist(voter_key.into());
|
||||
|
||||
#[extrinsic_call]
|
||||
close(SystemOrigin::Signed(voter), last_hash.clone(), index, Weight::MAX, bytes_in_storage);
|
||||
close(SystemOrigin::Signed(voter), last_hash, index, Weight::MAX, bytes_in_storage);
|
||||
|
||||
assert_eq!(T::ProposalProvider::proposal_of(last_hash), None);
|
||||
Ok(())
|
||||
@@ -330,7 +320,7 @@ mod benchmarks {
|
||||
// approval vote
|
||||
Alliance::<T, I>::vote(
|
||||
SystemOrigin::Signed(proposer.clone()).into(),
|
||||
last_hash.clone(),
|
||||
last_hash,
|
||||
index,
|
||||
false,
|
||||
)?;
|
||||
@@ -340,7 +330,7 @@ mod benchmarks {
|
||||
let voter = &members[j as usize];
|
||||
Alliance::<T, I>::vote(
|
||||
SystemOrigin::Signed(voter.clone()).into(),
|
||||
last_hash.clone(),
|
||||
last_hash,
|
||||
index,
|
||||
false,
|
||||
)?;
|
||||
@@ -349,22 +339,17 @@ mod benchmarks {
|
||||
// Member zero is the first aye
|
||||
Alliance::<T, I>::vote(
|
||||
SystemOrigin::Signed(members[0].clone()).into(),
|
||||
last_hash.clone(),
|
||||
last_hash,
|
||||
index,
|
||||
true,
|
||||
)?;
|
||||
|
||||
let voter = members[1].clone();
|
||||
// Caller switches vote to aye, which passes the vote
|
||||
Alliance::<T, I>::vote(
|
||||
SystemOrigin::Signed(voter.clone()).into(),
|
||||
last_hash.clone(),
|
||||
index,
|
||||
true,
|
||||
)?;
|
||||
Alliance::<T, I>::vote(SystemOrigin::Signed(voter.clone()).into(), last_hash, index, true)?;
|
||||
|
||||
#[extrinsic_call]
|
||||
close(SystemOrigin::Signed(voter), last_hash.clone(), index, Weight::MAX, bytes_in_storage);
|
||||
close(SystemOrigin::Signed(voter), last_hash, index, Weight::MAX, bytes_in_storage);
|
||||
|
||||
assert_eq!(T::ProposalProvider::proposal_of(last_hash), None);
|
||||
Ok(())
|
||||
@@ -414,7 +399,7 @@ mod benchmarks {
|
||||
let voter = &members[j as usize];
|
||||
Alliance::<T, I>::vote(
|
||||
SystemOrigin::Signed(voter.clone()).into(),
|
||||
last_hash.clone(),
|
||||
last_hash,
|
||||
index,
|
||||
true,
|
||||
)?;
|
||||
@@ -422,7 +407,7 @@ mod benchmarks {
|
||||
|
||||
Alliance::<T, I>::vote(
|
||||
SystemOrigin::Signed(voter.clone()).into(),
|
||||
last_hash.clone(),
|
||||
last_hash,
|
||||
index,
|
||||
false,
|
||||
)?;
|
||||
@@ -430,7 +415,7 @@ mod benchmarks {
|
||||
System::<T>::set_block_number(BlockNumberFor::<T>::max_value());
|
||||
|
||||
#[extrinsic_call]
|
||||
close(SystemOrigin::Signed(voter), last_hash.clone(), index, Weight::MAX, bytes_in_storage);
|
||||
close(SystemOrigin::Signed(voter), last_hash, index, Weight::MAX, bytes_in_storage);
|
||||
|
||||
// The last proposal is removed.
|
||||
assert_eq!(T::ProposalProvider::proposal_of(last_hash), None);
|
||||
@@ -477,7 +462,7 @@ mod benchmarks {
|
||||
// The prime member votes aye, so abstentions default to aye.
|
||||
Alliance::<T, I>::vote(
|
||||
SystemOrigin::Signed(proposer.clone()).into(),
|
||||
last_hash.clone(),
|
||||
last_hash,
|
||||
p - 1,
|
||||
true, // Vote aye.
|
||||
)?;
|
||||
@@ -489,7 +474,7 @@ mod benchmarks {
|
||||
let voter = &members[j as usize];
|
||||
Alliance::<T, I>::vote(
|
||||
SystemOrigin::Signed(voter.clone()).into(),
|
||||
last_hash.clone(),
|
||||
last_hash,
|
||||
index,
|
||||
false,
|
||||
)?;
|
||||
@@ -499,13 +484,7 @@ mod benchmarks {
|
||||
System::<T>::set_block_number(BlockNumberFor::<T>::max_value());
|
||||
|
||||
#[extrinsic_call]
|
||||
close(
|
||||
SystemOrigin::Signed(proposer),
|
||||
last_hash.clone(),
|
||||
index,
|
||||
Weight::MAX,
|
||||
bytes_in_storage,
|
||||
);
|
||||
close(SystemOrigin::Signed(proposer), last_hash, index, Weight::MAX, bytes_in_storage);
|
||||
|
||||
assert_eq!(T::ProposalProvider::proposal_of(last_hash), None);
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user