Skip to content

Fix clippy issues #1884

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ clippy-nightly:
RUSTFLAGS: "-D warnings"
script:
# clippy currently is raising `derive-partial-eq-without-eq` warning even if `Eq` is actually derived
- SKIP_WASM_BUILD=1 cargo +nightly clippy --all-targets -- -A clippy::redundant_closure -A clippy::derive-partial-eq-without-eq -A clippy::or_fun_call
- SKIP_WASM_BUILD=1 cargo +nightly clippy --all-targets -- -A clippy::redundant_closure -A clippy::derive-partial-eq-without-eq -A clippy::or_fun_call -A clippy::extra_unused_type_parameters

fmt:
stage: lint
Expand Down
1 change: 0 additions & 1 deletion bin/millau/runtime/src/rialto_messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ mod tests {
RialtoGrandpaInstance,
WithRialtoMessagesInstance,
WithRialtoMessageBridge,
bp_millau::Millau,
>(AssertCompleteBridgeConstants {
this_chain_constants: AssertChainConstants {
block_length: bp_millau::BlockLength::get(),
Expand Down
1 change: 0 additions & 1 deletion bin/rialto/runtime/src/millau_messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ mod tests {
MillauGrandpaInstance,
WithMillauMessagesInstance,
WithMillauMessageBridge,
bp_rialto::Rialto,
>(AssertCompleteBridgeConstants {
this_chain_constants: AssertChainConstants {
block_length: bp_rialto::BlockLength::get(),
Expand Down
9 changes: 4 additions & 5 deletions bin/runtime-common/src/integrity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,9 @@ pub struct AssertChainConstants {
///
/// 1) block weight 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
R: frame_system::Config,
C: Chain,
{
// 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
Expand Down Expand Up @@ -274,17 +273,16 @@ pub struct AssertCompleteBridgeConstants<'a> {

/// All bridge-related constants tests for the complete standard messages bridge (i.e. with bridge
/// 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
R: frame_system::Config
+ pallet_bridge_grandpa::Config<GI>
+ pallet_bridge_messages::Config<MI>,
GI: 'static,
MI: 'static,
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_messages_pallet_constants::<R, MI>(params.messages_pallet_constants);
assert_bridge_pallet_names::<B, R, GI, MI>(params.pallet_names);
Expand Down Expand Up @@ -325,6 +323,7 @@ pub fn check_message_lane_weights<C: Chain, T: frame_system::Config>(
///
/// This method doesn't perform any `assert`. If the condition is not true it will generate a
/// compile-time error.
#[allow(clippy::extra_unused_type_parameters)]
pub fn check_additional_signed<SignedExt, IndirectSignedExt: SignedExtension>()
where
SignedExt: SignedExtension,
Expand Down
4 changes: 2 additions & 2 deletions modules/beefy/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
/// 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
}

Expand All @@ -67,7 +67,7 @@ fn verify_signatures<T: Config<I>, I: 'static>(

// Ensure that the commitment was signed by enough authorities.
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
authority_set.validators().iter().zip(commitment.signatures.iter()).enumerate()
{
Expand Down