From 0decffc3db34176710aa88a3a02e78badb9a19db Mon Sep 17 00:00:00 2001 From: Gregory Tsipenyuk Date: Wed, 10 Jul 2024 13:54:11 -0400 Subject: [PATCH] Fix clang format --- include/xrpl/basics/MPTAmount.h | 3 +-- include/xrpl/protocol/SOTemplate.h | 1 - include/xrpl/protocol/STEitherAmount.h | 2 +- src/libxrpl/protocol/STMPTAmount.cpp | 3 +-- src/test/jtx/TestHelpers.h | 10 +++++----- src/test/jtx/amount.h | 16 +++++++--------- src/test/jtx/impl/AMM.cpp | 4 ++-- src/test/jtx/impl/amount.cpp | 3 +-- src/xrpld/app/tx/detail/Payment.h | 9 ++++----- 9 files changed, 22 insertions(+), 29 deletions(-) diff --git a/include/xrpl/basics/MPTAmount.h b/include/xrpl/basics/MPTAmount.h index c579170b36a..d0060489b4f 100644 --- a/include/xrpl/basics/MPTAmount.h +++ b/include/xrpl/basics/MPTAmount.h @@ -103,8 +103,7 @@ constexpr MPTAmount::MPTAmount(value_type value) : value_(value) { } -constexpr MPTAmount& -MPTAmount::operator=(beast::Zero) +constexpr MPTAmount& MPTAmount::operator=(beast::Zero) { value_ = 0; return *this; diff --git a/include/xrpl/protocol/SOTemplate.h b/include/xrpl/protocol/SOTemplate.h index f89681162d7..bf190cf28d8 100644 --- a/include/xrpl/protocol/SOTemplate.h +++ b/include/xrpl/protocol/SOTemplate.h @@ -24,7 +24,6 @@ #include #include #include -#include #include #include diff --git a/include/xrpl/protocol/STEitherAmount.h b/include/xrpl/protocol/STEitherAmount.h index 3fa7b7ea7af..fac233f8894 100644 --- a/include/xrpl/protocol/STEitherAmount.h +++ b/include/xrpl/protocol/STEitherAmount.h @@ -32,7 +32,7 @@ concept ValidAmountType = // Currency or MPT issuance ID template concept ValidAssetType = -std::is_same_v || std::is_same_v; + std::is_same_v || std::is_same_v; class STEitherAmount : public STBase, public CountedObject { diff --git a/src/libxrpl/protocol/STMPTAmount.cpp b/src/libxrpl/protocol/STMPTAmount.cpp index 7d61c92953e..b1c5a782c66 100644 --- a/src/libxrpl/protocol/STMPTAmount.cpp +++ b/src/libxrpl/protocol/STMPTAmount.cpp @@ -81,8 +81,7 @@ STMPTAmount::getText() const return std::to_string(value_); } -Json::Value -STMPTAmount::getJson(JsonOptions) const +Json::Value STMPTAmount::getJson(JsonOptions) const { Json::Value elem; setJson(elem); diff --git a/src/test/jtx/TestHelpers.h b/src/test/jtx/TestHelpers.h index 5b8ff5446a8..1e184acb1cf 100644 --- a/src/test/jtx/TestHelpers.h +++ b/src/test/jtx/TestHelpers.h @@ -39,11 +39,11 @@ namespace jtx { // when we have moved to better compilers. template auto -make_vector(Input const& input) - requires requires(Input& v) { - std::begin(v); - std::end(v); - } +make_vector(Input const& input) requires requires(Input& v) +{ + std::begin(v); + std::end(v); +} { return std::vector(std::begin(input), std::end(input)); } diff --git a/src/test/jtx/amount.h b/src/test/jtx/amount.h index a5b1f0a4d45..4d13a6f6aaf 100644 --- a/src/test/jtx/amount.h +++ b/src/test/jtx/amount.h @@ -130,7 +130,7 @@ struct PrettyAmount return amount_; } - operator STAmount const&() const + operator STAmount const &() const { return amount_; } @@ -195,7 +195,7 @@ struct PrettyAmount return amount_; } - operator STMPTAmount const&() const + operator STMPTAmount const &() const { return amount_; } @@ -351,8 +351,7 @@ struct XRP_t /** @} */ /** Returns None-of-XRP */ - None - operator()(none_t) const + None operator()(none_t) const { return {xrpIssue()}; } @@ -475,8 +474,7 @@ class IOU // STAmount operator()(char const* s) const; /** Returns None-of-Issue */ - None - operator()(none_t) const + None operator()(none_t) const { return {issue()}; } @@ -528,9 +526,9 @@ class MPT } template - requires(sizeof(T) >= sizeof(int) && std::is_arithmetic_v) - PrettyAmount - operator()(T v) const + requires(sizeof(T) >= sizeof(int) && std::is_arithmetic_v) + PrettyAmount + operator()(T v) const { // VFALCO NOTE Should throw if the // representation of v is not exact. diff --git a/src/test/jtx/impl/AMM.cpp b/src/test/jtx/impl/AMM.cpp index 9c5050cfb0e..9c5e17f7b75 100644 --- a/src/test/jtx/impl/AMM.cpp +++ b/src/test/jtx/impl/AMM.cpp @@ -42,8 +42,8 @@ static IOUAmount initialTokens(STAmount const& asset1, STAmount const& asset2) { auto const product = number(asset1) * number(asset2); - return ( - IOUAmount)(product.mantissa() >= 0 ? root2(product) : root2(-product)); + return (IOUAmount)( + product.mantissa() >= 0 ? root2(product) : root2(-product)); } AMM::AMM( diff --git a/src/test/jtx/impl/amount.cpp b/src/test/jtx/impl/amount.cpp index 702313d8bc5..84cd76461f5 100644 --- a/src/test/jtx/impl/amount.cpp +++ b/src/test/jtx/impl/amount.cpp @@ -51,8 +51,7 @@ operator<<(std::ostream&& os, XRP_t const XRP{}; -PrettyAmount -IOU::operator()(epsilon_t) const +PrettyAmount IOU::operator()(epsilon_t) const { return {STAmount(issue(), 1, -81), account.name()}; } diff --git a/src/xrpld/app/tx/detail/Payment.h b/src/xrpld/app/tx/detail/Payment.h index 7e507324ff4..f3d930b43c1 100644 --- a/src/xrpld/app/tx/detail/Payment.h +++ b/src/xrpld/app/tx/detail/Payment.h @@ -205,7 +205,8 @@ Payment::preflightHelper(PreflightContext const& ctx) << "Bad asset."; return temBAD_CURRENCY; } - if (account == uDstAccountID && sameAsset(uSrcCurrency, uDstCurrency) && !bPaths) + if (account == uDstAccountID && sameAsset(uSrcCurrency, uDstCurrency) && + !bPaths) { // You're signing yourself a payment. // If bPaths is true, you might be trying some arbitrage. @@ -403,10 +404,8 @@ Payment::doApplyHelper() AccountID const uDstAccountID(ctx_.tx.getAccountID(sfDestination)); auto const saDstAmount(get(ctx_.tx.getFieldAmount(sfAmount))); - auto const maxSourceAmount = getMaxSourceAmount( - saDstAmount, - sendMax, - account_); + auto const maxSourceAmount = + getMaxSourceAmount(saDstAmount, sendMax, account_); JLOG(j_.trace()) << "maxSourceAmount=" << maxSourceAmount.getFullText() << " saDstAmount=" << saDstAmount.getFullText();