From af81f41706e56d5e4eed168b84a54102750eb03b Mon Sep 17 00:00:00 2001 From: iceseer Date: Fri, 13 Dec 2024 10:36:38 +0300 Subject: [PATCH] clang-tidy Signed-off-by: iceseer --- core/parachain/approval/knowledge.hpp | 3 ++- core/scale/encoder/concepts.hpp | 3 ++- core/scale/encoder/primitives.hpp | 15 ++++++++++----- core/scale/kagome_scale.hpp | 3 ++- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/core/parachain/approval/knowledge.hpp b/core/parachain/approval/knowledge.hpp index 1fe0aba4a4..5cb51df094 100644 --- a/core/parachain/approval/knowledge.hpp +++ b/core/parachain/approval/knowledge.hpp @@ -11,6 +11,7 @@ #include "common/visitor.hpp" #include "consensus/timeline/types.hpp" #include "outcome/outcome.hpp" +#include "parachain/approval/approval.hpp" #include "parachain/approval/state.hpp" #include "parachain/types.hpp" @@ -86,7 +87,7 @@ namespace kagome::parachain::approval { // Generate the knowledge keys for querying if an approval is known by peer. static std::pair generate_approval_key( - const approval::IndirectSignedApprovalVoteV2 &approval) { + const IndirectSignedApprovalVoteV2 &approval) { return { std::make_tuple(approval.payload.payload.block_hash, approval.payload.payload.candidate_indices, diff --git a/core/scale/encoder/concepts.hpp b/core/scale/encoder/concepts.hpp index f9b9638f4b..10d5800299 100644 --- a/core/scale/encoder/concepts.hpp +++ b/core/scale/encoder/concepts.hpp @@ -6,11 +6,12 @@ #pragma once +#include #include namespace kagome::scale { template - concept Invocable = std::is_invocable_v; + concept Invocable = std::is_invocable_v; template concept IsEnum = std::is_enum_v>; diff --git a/core/scale/encoder/primitives.hpp b/core/scale/encoder/primitives.hpp index cbe86f2cc8..8b09d7619f 100644 --- a/core/scale/encoder/primitives.hpp +++ b/core/scale/encoder/primitives.hpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -19,6 +20,7 @@ #include #include #include "crypto/ecdsa_types.hpp" +#include "primitives/math.hpp" #include "scale/encoder/concepts.hpp" #include "utils/struct_to_tuple.hpp" @@ -51,8 +53,10 @@ namespace kagome::scale { constexpr void encode(const Invocable auto &func, const std::array &c); + // NOLINTBEGIN template constexpr void encode(const Invocable auto &func, const T (&c)[N]); + // NOLINTEND template constexpr void encode(const Invocable auto &func, const std::map &c); @@ -134,6 +138,7 @@ namespace kagome::scale { kagome::scale::encode(func, args...); } + // NOLINTBEGIN(cppcoreguidelines-pro-bounds-pointer-arithmetic) template outcome::result> encode(const Args &...args) { std::vector res; @@ -185,6 +190,7 @@ namespace kagome::scale { } return counter; } + // NOLINTEND(cppcoreguidelines-pro-bounds-pointer-arithmetic) constexpr void putByte(const Invocable auto &func, const uint8_t *const val, @@ -205,6 +211,7 @@ namespace kagome::scale { } } + // NOLINTBEGIN template constexpr void encode(const Invocable auto &func, const T (&c)[N]) { using E = std::decay_t; @@ -216,6 +223,7 @@ namespace kagome::scale { } } } + // NOLINTEND template void encode(const Invocable auto &func, const boost::variant &v) { @@ -472,15 +480,12 @@ namespace kagome::scale { void encode(const Invocable auto &func, const crypto::EcdsaSignature &data) { kagome::scale::encode( - func, - static_cast(data)); + func, static_cast(data)); } void encode(const Invocable auto &func, const crypto::EcdsaPublicKey &data) { kagome::scale::encode( - func, - static_cast< - const crypto::EcdsaPublicKey::Base &>(data)); + func, static_cast(data)); } } // namespace kagome::scale diff --git a/core/scale/kagome_scale.hpp b/core/scale/kagome_scale.hpp index 16d6164aa0..aa1c90d5a7 100644 --- a/core/scale/kagome_scale.hpp +++ b/core/scale/kagome_scale.hpp @@ -241,7 +241,8 @@ namespace kagome::scale { } constexpr void encode(const Invocable auto &func, const network::Roles &c) { - kagome::scale::encode(func, c.value); + kagome::scale::encode( + func, c.value); // NOLINT(cppcoreguidelines-pro-type-union-access) } constexpr void encode(const Invocable auto &func,