From c9f6b5a1dbfeee87991a2a538b8897ef8f5552c7 Mon Sep 17 00:00:00 2001 From: Scott Schurr Date: Wed, 31 Jul 2024 12:46:29 -0700 Subject: [PATCH] [FOLD] Fix clang-format --- include/xrpl/basics/Expected.h | 35 +++++++-------------- src/test/app/NFTokenBurn_test.cpp | 3 +- src/xrpld/app/misc/detail/ValidatorList.cpp | 3 +- src/xrpld/rpc/detail/ServerHandler.cpp | 6 ++-- 4 files changed, 18 insertions(+), 29 deletions(-) diff --git a/include/xrpl/basics/Expected.h b/include/xrpl/basics/Expected.h index eb8bdff4389..745fa50a69f 100644 --- a/include/xrpl/basics/Expected.h +++ b/include/xrpl/basics/Expected.h @@ -136,7 +136,7 @@ class [[nodiscard]] Expected public: template - requires std::convertible_to constexpr Expected(U&& r) + requires std::convertible_to constexpr Expected(U && r) : Base(T(std::forward(r))) { } @@ -148,32 +148,27 @@ class [[nodiscard]] Expected { } - constexpr bool - has_value() const + constexpr bool has_value() const { return Base::has_value(); } - constexpr T const& - value() const + constexpr T const& value() const { return Base::value(); } - constexpr T& - value() + constexpr T& value() { return Base::value(); } - constexpr E const& - error() const + constexpr E const& error() const { return Base::error(); } - constexpr E& - error() + constexpr E& error() { return Base::error(); } @@ -186,26 +181,22 @@ class [[nodiscard]] Expected // Add operator* and operator-> so the Expected API looks a bit more like // what std::expected is likely to look like. See: // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p0323r10.html - [[nodiscard]] constexpr T& - operator*() + [[nodiscard]] constexpr T& operator*() { return this->value(); } - [[nodiscard]] constexpr T const& - operator*() const + [[nodiscard]] constexpr T const& operator*() const { return this->value(); } - [[nodiscard]] constexpr T* - operator->() + [[nodiscard]] constexpr T* operator->() { return &this->value(); } - [[nodiscard]] constexpr T const* - operator->() const + [[nodiscard]] constexpr T const* operator->() const { return &this->value(); } @@ -233,14 +224,12 @@ class [[nodiscard]] Expected { } - constexpr E const& - error() const + constexpr E const& error() const { return Base::error(); } - constexpr E& - error() + constexpr E& error() { return Base::error(); } diff --git a/src/test/app/NFTokenBurn_test.cpp b/src/test/app/NFTokenBurn_test.cpp index a84ac63da9d..35a8858f868 100644 --- a/src/test/app/NFTokenBurn_test.cpp +++ b/src/test/app/NFTokenBurn_test.cpp @@ -323,8 +323,7 @@ class NFTokenBurnBaseUtil_test : public beast::unit_test::suite // Otherwise either alice or minter can burn. AcctStat& burner = owner.acct == becky.acct ? *(stats[acctDist(engine)]) - : mintDist(engine) ? alice - : minter; + : mintDist(engine) ? alice : minter; if (owner.acct == burner.acct) env(token::burn(burner, nft)); diff --git a/src/xrpld/app/misc/detail/ValidatorList.cpp b/src/xrpld/app/misc/detail/ValidatorList.cpp index 9a323e0116b..a3854106a1c 100644 --- a/src/xrpld/app/misc/detail/ValidatorList.cpp +++ b/src/xrpld/app/misc/detail/ValidatorList.cpp @@ -689,7 +689,8 @@ ValidatorList::sendValidatorList( beast::Journal j) { std::size_t const messageVersion = - peer.supportsFeature(ProtocolFeature::ValidatorList2Propagation) ? 2 + peer.supportsFeature(ProtocolFeature::ValidatorList2Propagation) + ? 2 : peer.supportsFeature(ProtocolFeature::ValidatorListPropagation) ? 1 : 0; if (!messageVersion) diff --git a/src/xrpld/rpc/detail/ServerHandler.cpp b/src/xrpld/rpc/detail/ServerHandler.cpp index ccf0c12b5ad..c006111894b 100644 --- a/src/xrpld/rpc/detail/ServerHandler.cpp +++ b/src/xrpld/rpc/detail/ServerHandler.cpp @@ -388,9 +388,9 @@ logDuration( beast::Journal& journal) { using namespace std::chrono_literals; - auto const level = (duration >= 10s) ? journal.error() - : (duration >= 1s) ? journal.warn() - : journal.debug(); + auto const level = (duration >= 10s) + ? journal.error() + : (duration >= 1s) ? journal.warn() : journal.debug(); JLOG(level) << "RPC request processing duration = " << std::chrono::duration_cast(