From 0e25c0cabc03aada88d321606a683a63a6f3595b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 09:33:53 +0000 Subject: [PATCH] style: clang-tidy auto fixes (#1730) Fixes #1729. Please review and commit clang-tidy fixes. Co-authored-by: kuznetsss <15742918+kuznetsss@users.noreply.github.com> --- src/data/CassandraBackend.hpp | 5 +++-- src/etl/MPTHelpers.cpp | 13 +++++++++---- src/rpc/RPCHelpers.cpp | 1 + src/rpc/handlers/MPTHolders.cpp | 7 ++++--- tests/common/util/TestObject.cpp | 2 +- tests/unit/rpc/handlers/LedgerDataTests.cpp | 1 + tests/unit/rpc/handlers/MPTHoldersTests.cpp | 1 + 7 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/data/CassandraBackend.hpp b/src/data/CassandraBackend.hpp index c3ffdff5..05026087 100644 --- a/src/data/CassandraBackend.hpp +++ b/src/data/CassandraBackend.hpp @@ -575,7 +575,7 @@ public: auto mptObjects = doFetchLedgerObjects(mptKeys, ledgerSequence, yield); - auto it = std::remove_if(mptObjects.begin(), mptObjects.end(), [](Blob const& mpt) { return mpt.size() == 0; }); + auto it = std::remove_if(mptObjects.begin(), mptObjects.end(), [](Blob const& mpt) { return mpt.empty(); }); mptObjects.erase(it, mptObjects.end()); @@ -948,7 +948,8 @@ public: writeMPTHolders(std::vector const& data) override { std::vector statements; - for (auto [mptId, holder] : data) + statements.reserve(data.size()); +for (auto [mptId, holder] : data) statements.push_back(schema_->insertMPTHolder.bind(std::move(mptId), std::move(holder))); executor_.write(std::move(statements)); diff --git a/src/etl/MPTHelpers.cpp b/src/etl/MPTHelpers.cpp index dd712633..ba17d2b1 100644 --- a/src/etl/MPTHelpers.cpp +++ b/src/etl/MPTHelpers.cpp @@ -17,16 +17,21 @@ */ //============================================================================== -#include "data/BackendInterface.hpp" #include "data/DBHelpers.hpp" -#include "data/Types.hpp" -#include #include #include #include +#include +#include +#include +#include +#include +#include +#include -#include +#include +#include namespace etl { diff --git a/src/rpc/RPCHelpers.cpp b/src/rpc/RPCHelpers.cpp index 7e5aac45..1db828f1 100644 --- a/src/rpc/RPCHelpers.cpp +++ b/src/rpc/RPCHelpers.cpp @@ -81,6 +81,7 @@ #include #include +#include #include #include #include diff --git a/src/rpc/handlers/MPTHolders.cpp b/src/rpc/handlers/MPTHolders.cpp index 326859d0..e248297f 100644 --- a/src/rpc/handlers/MPTHolders.cpp +++ b/src/rpc/handlers/MPTHolders.cpp @@ -24,17 +24,18 @@ #include "rpc/RPCHelpers.hpp" #include "rpc/common/Types.hpp" +#include #include #include #include #include #include #include -#include #include #include #include -#include +#include +#include #include #include @@ -73,7 +74,7 @@ MPTHoldersHandler::process(MPTHoldersHandler::Input input, Context const& ctx) c output.limit = limit; output.ledgerIndex = lgrInfo.seq; - boost::json::array mpts; + boost::json::array const mpts; for (auto const& mpt : dbResponse.mptokens) { ripple::STLedgerEntry const sle{ripple::SerialIter{mpt.data(), mpt.size()}, keylet::mptIssuance(mptID).key}; boost::json::object mptJson; diff --git a/tests/common/util/TestObject.cpp b/tests/common/util/TestObject.cpp index cc12b2df..2f9e8bae 100644 --- a/tests/common/util/TestObject.cpp +++ b/tests/common/util/TestObject.cpp @@ -1135,7 +1135,7 @@ CreateMPTokenObject(std::string_view accountId, ripple::uint192 issuanceID, std: mptoken.setFieldH256(ripple::sfPreviousTxnID, ripple::uint256{}); mptoken.setFieldU32(ripple::sfPreviousTxnLgrSeq, 0); - if (mptAmount) + if (mptAmount != 0u) mptoken.setFieldU64(ripple::sfMPTAmount, mptAmount); return mptoken; diff --git a/tests/unit/rpc/handlers/LedgerDataTests.cpp b/tests/unit/rpc/handlers/LedgerDataTests.cpp index 1c7842b5..676dde02 100644 --- a/tests/unit/rpc/handlers/LedgerDataTests.cpp +++ b/tests/unit/rpc/handlers/LedgerDataTests.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include diff --git a/tests/unit/rpc/handlers/MPTHoldersTests.cpp b/tests/unit/rpc/handlers/MPTHoldersTests.cpp index 984b7153..dbba7dc1 100644 --- a/tests/unit/rpc/handlers/MPTHoldersTests.cpp +++ b/tests/unit/rpc/handlers/MPTHoldersTests.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include