Fix clippy issues (#1884)

* fix clippy issues

* fix?

* fix?

* forget about extra_unused_type_parameters lint for now
This commit is contained in:
Svyatoslav Nikolsky
2023-02-16 11:16:02 +03:00
committed by Bastian Köcher
parent 25c17feb23
commit 914213d0af
4 changed files with 5 additions and 9 deletions
@@ -162,7 +162,6 @@ mod tests {
RialtoGrandpaInstance, RialtoGrandpaInstance,
WithRialtoMessagesInstance, WithRialtoMessagesInstance,
WithRialtoMessageBridge, WithRialtoMessageBridge,
bp_millau::Millau,
>(AssertCompleteBridgeConstants { >(AssertCompleteBridgeConstants {
this_chain_constants: AssertChainConstants { this_chain_constants: AssertChainConstants {
block_length: bp_millau::BlockLength::get(), block_length: bp_millau::BlockLength::get(),
@@ -161,7 +161,6 @@ mod tests {
MillauGrandpaInstance, MillauGrandpaInstance,
WithMillauMessagesInstance, WithMillauMessagesInstance,
WithMillauMessageBridge, WithMillauMessageBridge,
bp_rialto::Rialto,
>(AssertCompleteBridgeConstants { >(AssertCompleteBridgeConstants {
this_chain_constants: AssertChainConstants { this_chain_constants: AssertChainConstants {
block_length: bp_rialto::BlockLength::get(), block_length: bp_rialto::BlockLength::get(),
+3 -5
View File
@@ -141,10 +141,9 @@ pub struct AssertChainConstants {
/// ///
/// 1) block weight limits are matching; /// 1) block weight limits are matching;
/// 2) block size limits are matching. /// 2) block size limits are matching.
pub fn assert_chain_constants<R, C>(params: AssertChainConstants) pub fn assert_chain_constants<R>(params: AssertChainConstants)
where where
R: frame_system::Config, R: frame_system::Config,
C: Chain,
{ {
// we don't check runtime version here, because in our case we'll be building relay from one // we don't check runtime version here, because in our case we'll be building relay from one
// repo and runtime will live in another repo, along with outdated relay version. To avoid // repo and runtime will live in another repo, along with outdated relay version. To avoid
@@ -274,7 +273,7 @@ pub struct AssertCompleteBridgeConstants<'a> {
/// All bridge-related constants tests for the complete standard messages bridge (i.e. with bridge /// All bridge-related constants tests for the complete standard messages bridge (i.e. with bridge
/// GRANDPA and messages pallets deployed). /// GRANDPA and messages pallets deployed).
pub fn assert_complete_bridge_constants<R, GI, MI, B, This>(params: AssertCompleteBridgeConstants) pub fn assert_complete_bridge_constants<R, GI, MI, B>(params: AssertCompleteBridgeConstants)
where where
R: frame_system::Config R: frame_system::Config
+ pallet_bridge_grandpa::Config<GI> + pallet_bridge_grandpa::Config<GI>
@@ -282,9 +281,8 @@ where
GI: 'static, GI: 'static,
MI: 'static, MI: 'static,
B: MessageBridge, B: MessageBridge,
This: Chain,
{ {
assert_chain_constants::<R, This>(params.this_chain_constants); assert_chain_constants::<R>(params.this_chain_constants);
assert_bridge_grandpa_pallet_constants::<R, GI>(); assert_bridge_grandpa_pallet_constants::<R, GI>();
assert_bridge_messages_pallet_constants::<R, MI>(params.messages_pallet_constants); assert_bridge_messages_pallet_constants::<R, MI>(params.messages_pallet_constants);
assert_bridge_pallet_names::<B, R, GI, MI>(params.pallet_names); assert_bridge_pallet_names::<B, R, GI, MI>(params.pallet_names);
+2 -2
View File
@@ -52,7 +52,7 @@ fn verify_authority_set<T: Config<I>, I: 'static>(
/// ///
/// We're using 'conservative' approach here, where signatures of `2/3+1` validators are /// We're using 'conservative' approach here, where signatures of `2/3+1` validators are
/// required.. /// required..
pub(crate) fn signatures_required<T: Config<I>, I: 'static>(validators_len: usize) -> usize { pub(crate) fn signatures_required(validators_len: usize) -> usize {
validators_len - validators_len.saturating_sub(1) / 3 validators_len - validators_len.saturating_sub(1) / 3
} }
@@ -67,7 +67,7 @@ fn verify_signatures<T: Config<I>, I: 'static>(
// Ensure that the commitment was signed by enough authorities. // Ensure that the commitment was signed by enough authorities.
let msg = commitment.commitment.encode(); let msg = commitment.commitment.encode();
let mut missing_signatures = signatures_required::<T, I>(authority_set.len()); let mut missing_signatures = signatures_required(authority_set.len());
for (idx, (authority, maybe_sig)) in for (idx, (authority, maybe_sig)) in
authority_set.validators().iter().zip(commitment.signatures.iter()).enumerate() authority_set.validators().iter().zip(commitment.signatures.iter()).enumerate()
{ {