From f658656b82bf4939ebf884486f89b75efa3fe467 Mon Sep 17 00:00:00 2001 From: Joe Loser Date: Sun, 20 May 2018 22:23:44 -0400 Subject: [PATCH] Mark some single-argument constructors explicit --- src/ripple/beast/insight/impl/Groups.cpp | 2 +- src/ripple/core/impl/SNTPClock.cpp | 2 +- src/ripple/rpc/impl/TransactionSign.cpp | 2 +- src/test/app/Check_test.cpp | 10 +++++----- src/test/app/Escrow_test.cpp | 4 ++-- src/test/app/PayStrand_test.cpp | 2 +- src/test/consensus/Validations_test.cpp | 2 +- src/test/core/Stoppable_test.cpp | 2 +- src/test/core/TerminateHandler_test.cpp | 4 ++-- src/test/overlay/short_read_test.cpp | 6 +++--- src/test/server/Server_test.cpp | 4 ++-- 11 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/ripple/beast/insight/impl/Groups.cpp b/src/ripple/beast/insight/impl/Groups.cpp index 8d9de1b0d..63572de04 100644 --- a/src/ripple/beast/insight/impl/Groups.cpp +++ b/src/ripple/beast/insight/impl/Groups.cpp @@ -98,7 +98,7 @@ public: Collector::ptr m_collector; Items m_items; - GroupsImp (Collector::ptr const& collector) + explicit GroupsImp (Collector::ptr const& collector) : m_collector (collector) { } diff --git a/src/ripple/core/impl/SNTPClock.cpp b/src/ripple/core/impl/SNTPClock.cpp index 987a34e12..2bf134737 100644 --- a/src/ripple/core/impl/SNTPClock.cpp +++ b/src/ripple/core/impl/SNTPClock.cpp @@ -82,7 +82,7 @@ private: sys_seconds sent; std::uint32_t nonce; - Query (sys_seconds j = sys_seconds::max()) + explicit Query (sys_seconds j = sys_seconds::max()) : replied (false) , sent (j) { diff --git a/src/ripple/rpc/impl/TransactionSign.cpp b/src/ripple/rpc/impl/TransactionSign.cpp index b3f47d0bd..3c1fff6e3 100644 --- a/src/ripple/rpc/impl/TransactionSign.cpp +++ b/src/ripple/rpc/impl/TransactionSign.cpp @@ -327,7 +327,7 @@ struct transactionPreProcessResult , second () { } - transactionPreProcessResult (std::shared_ptr&& st) + explicit transactionPreProcessResult (std::shared_ptr&& st) : first () , second (std::move (st)) { } diff --git a/src/test/app/Check_test.cpp b/src/test/app/Check_test.cpp index 71ab664c6..a6dd15798 100644 --- a/src/test/app/Check_test.cpp +++ b/src/test/app/Check_test.cpp @@ -49,7 +49,7 @@ create (jtx::Account const& account, struct DeliverMin { STAmount value; - DeliverMin (STAmount const& deliverMin) + explicit DeliverMin (STAmount const& deliverMin) : value (deliverMin) { } }; @@ -101,7 +101,7 @@ private: std::uint32_t const expry_; public: - expiration (NetClock::time_point const& expiry) + explicit expiration (NetClock::time_point const& expiry) : expry_{expiry.time_since_epoch().count()} { } @@ -120,7 +120,7 @@ private: std::uint32_t const tag_; public: - source_tag (std::uint32_t tag) + explicit source_tag (std::uint32_t tag) : tag_{tag} { } @@ -139,7 +139,7 @@ private: std::uint32_t const tag_; public: - dest_tag (std::uint32_t tag) + explicit dest_tag (std::uint32_t tag) : tag_{tag} { } @@ -158,7 +158,7 @@ private: uint256 const id_; public: - invoice_id (uint256 const& id) + explicit invoice_id (uint256 const& id) : id_{id} { } diff --git a/src/test/app/Escrow_test.cpp b/src/test/app/Escrow_test.cpp index 1836ad84d..87d3ff5e5 100644 --- a/src/test/app/Escrow_test.cpp +++ b/src/test/app/Escrow_test.cpp @@ -127,7 +127,7 @@ struct Escrow_test : public beast::unit_test::suite } template - condition (std::array c) + explicit condition (std::array c) : condition(makeSlice(c)) { } @@ -152,7 +152,7 @@ struct Escrow_test : public beast::unit_test::suite } template - fulfillment (std::array f) + explicit fulfillment (std::array f) : fulfillment(makeSlice(f)) { } diff --git a/src/test/app/PayStrand_test.cpp b/src/test/app/PayStrand_test.cpp index 0aafb08c4..4c1e80908 100644 --- a/src/test/app/PayStrand_test.cpp +++ b/src/test/app/PayStrand_test.cpp @@ -363,7 +363,7 @@ struct ExistingElementPool ExistingElementPool& p_; ResetState state_; - StateGuard(ExistingElementPool& p) : p_{p}, state_{p.getResetState()} + explicit StateGuard(ExistingElementPool& p) : p_{p}, state_{p.getResetState()} { } ~StateGuard() diff --git a/src/test/consensus/Validations_test.cpp b/src/test/consensus/Validations_test.cpp index 35921c5ba..33c6488cf 100644 --- a/src/test/consensus/Validations_test.cpp +++ b/src/test/consensus/Validations_test.cpp @@ -244,7 +244,7 @@ class Validations_test : public beast::unit_test::suite PeerID nextNodeId_{0}; public: - TestHarness(LedgerOracle& o) + explicit TestHarness(LedgerOracle& o) : tv_(p_, clock_, staleData_, clock_, o) { } diff --git a/src/test/core/Stoppable_test.cpp b/src/test/core/Stoppable_test.cpp index f06aca772..65147a8e3 100644 --- a/src/test/core/Stoppable_test.cpp +++ b/src/test/core/Stoppable_test.cpp @@ -400,7 +400,7 @@ class Stoppable_test C c_; Stoppable_test& test_; public: - Root(Stoppable_test& test) + explicit Root(Stoppable_test& test) : RootStoppable("R") , a_(&A::run, std::make_unique(*this, test)) , b_(*this, test) diff --git a/src/test/core/TerminateHandler_test.cpp b/src/test/core/TerminateHandler_test.cpp index e9dc4f737..7d09a07c8 100644 --- a/src/test/core/TerminateHandler_test.cpp +++ b/src/test/core/TerminateHandler_test.cpp @@ -36,7 +36,7 @@ private: class CerrRedirect { public: - CerrRedirect (std::stringstream& sStream) + explicit CerrRedirect (std::stringstream& sStream) : old_ (std::cerr.rdbuf (sStream.rdbuf())) { } @@ -53,7 +53,7 @@ private: class ThreadNameGuard { public: - ThreadNameGuard (std::string const& newName) + explicit ThreadNameGuard (std::string const& newName) : old_ (beast::getCurrentThreadName ()) { beast::setCurrentThreadName (newName); diff --git a/src/test/overlay/short_read_test.cpp b/src/test/overlay/short_read_test.cpp index ce5f13339..1dcf303ac 100644 --- a/src/test/overlay/short_read_test.cpp +++ b/src/test/overlay/short_read_test.cpp @@ -87,7 +87,7 @@ private: Base& base_; public: - Child(Base& base) + explicit Child(Base& base) : base_(base) { } @@ -179,7 +179,7 @@ private: socket_type socket_; strand_type strand_; - Acceptor(Server& server) + explicit Acceptor(Server& server) : Child(server) , server_(server) , test_(server_.test_) @@ -368,7 +368,7 @@ private: }; public: - Server(short_read_test& test) + explicit Server(short_read_test& test) : test_(test) { auto const p = std::make_shared(*this); diff --git a/src/test/server/Server_test.cpp b/src/test/server/Server_test.cpp index 5856c9205..cdb79ff7e 100644 --- a/src/test/server/Server_test.cpp +++ b/src/test/server/Server_test.cpp @@ -73,7 +73,7 @@ public: beast::unit_test::suite& suite_; public: - TestSink (beast::unit_test::suite& suite) + explicit TestSink (beast::unit_test::suite& suite) : Sink (beast::severities::kWarning, false) , suite_ (suite) { @@ -396,7 +396,7 @@ public: std::string& result_; public: - CaptureLogs(std::string& result) + explicit CaptureLogs(std::string& result) : Logs (beast::severities::kInfo) , result_(result) {