refactor: Enable remaining clang-tidy cppcoreguidelines checks (#6538)

This commit is contained in:
Alex Kremer
2026-03-17 19:09:05 +00:00
committed by GitHub
parent b523770486
commit 72f4cb097f
148 changed files with 424 additions and 397 deletions

View File

@@ -1,6 +1,7 @@
#include <test/jtx/AMM.h>
#include <test/jtx/Env.h>
#include <xrpl/basics/safe_cast.h>
#include <xrpl/protocol/AMMCore.h>
#include <xrpl/protocol/AmountConversions.h>
#include <xrpl/protocol/ApiVersion.h>
@@ -627,7 +628,8 @@ AMM::bid(BidArg const& arg)
amm->isFieldPresent(sfAuctionSlot));
if (amm->isFieldPresent(sfAuctionSlot))
{
auto const& auctionSlot = static_cast<STObject const&>(amm->peekAtField(sfAuctionSlot));
auto const& auctionSlot =
safe_downcast<STObject const&>(amm->peekAtField(sfAuctionSlot));
lastPurchasePrice_ = auctionSlot[sfPrice].iou();
}
}
@@ -719,7 +721,8 @@ AMM::expectAuctionSlot(auto&& cb) const
amm->isFieldPresent(sfAuctionSlot));
if (amm->isFieldPresent(sfAuctionSlot))
{
auto const& auctionSlot = static_cast<STObject const&>(amm->peekAtField(sfAuctionSlot));
auto const& auctionSlot =
safe_downcast<STObject const&>(amm->peekAtField(sfAuctionSlot));
if (auctionSlot.isFieldPresent(sfAccount))
{
// This could fail in pre-fixInnerObjTemplate tests

View File

@@ -82,18 +82,17 @@ AMMTestBase::AMMTestBase()
void
AMMTestBase::testAMM(
std::function<void(jtx::AMM&, jtx::Env&)>&& cb,
std::function<void(jtx::AMM&, jtx::Env&)> const& cb,
std::optional<std::pair<STAmount, STAmount>> const& pool,
std::uint16_t tfee,
std::optional<jtx::ter> const& ter,
std::vector<FeatureBitset> const& vfeatures)
{
testAMM(
std::move(cb), TestAMMArg{.pool = pool, .tfee = tfee, .ter = ter, .features = vfeatures});
testAMM(cb, TestAMMArg{.pool = pool, .tfee = tfee, .ter = ter, .features = vfeatures});
}
void
AMMTestBase::testAMM(std::function<void(jtx::AMM&, jtx::Env&)>&& cb, TestAMMArg const& arg)
AMMTestBase::testAMM(std::function<void(jtx::AMM&, jtx::Env&)> const& cb, TestAMMArg const& arg)
{
using namespace jtx;

View File

@@ -273,7 +273,7 @@ Oracle::ledgerEntry(
toJson(jvParams[jss::oracle][jss::oracle_document_id], *documentID);
if (index)
{
std::uint32_t i;
std::uint32_t i = 0;
if (boost::conversion::try_lexical_convert(*index, i))
jvParams[jss::oracle][jss::ledger_index] = i;
else

View File

@@ -27,7 +27,7 @@ class WSClientImpl : public WSClient
{
Json::Value jv;
explicit msg(Json::Value&& jv_) : jv(jv_)
explicit msg(Json::Value&& jv_) : jv(std::move(jv_))
{
}
};