Mark single-argument constructors "explicit"

This commit is contained in:
practicalswift 2018-07-26 17:15:32 +02:00
parent 415f2bff69
commit 1ac3c983bf
8 changed files with 9 additions and 9 deletions

View file

@ -15,7 +15,7 @@ namespace {
class HandlerImpl : public Handler class HandlerImpl : public Handler
{ {
public: public:
HandlerImpl(boost::signals2::connection connection) : m_connection(std::move(connection)) {} explicit HandlerImpl(boost::signals2::connection connection) : m_connection(std::move(connection)) {}
void disconnect() override { m_connection.disconnect(); } void disconnect() override { m_connection.disconnect(); }

View file

@ -31,7 +31,7 @@ namespace {
class PendingWalletTxImpl : public PendingWalletTx class PendingWalletTxImpl : public PendingWalletTx
{ {
public: public:
PendingWalletTxImpl(CWallet& wallet) : m_wallet(wallet), m_key(&wallet) {} explicit PendingWalletTxImpl(CWallet& wallet) : m_wallet(wallet), m_key(&wallet) {}
const CTransaction& get() override { return *m_tx; } const CTransaction& get() override { return *m_tx; }
@ -117,7 +117,7 @@ WalletTxOut MakeWalletTxOut(CWallet& wallet, const CWalletTx& wtx, int n, int de
class WalletImpl : public Wallet class WalletImpl : public Wallet
{ {
public: public:
WalletImpl(const std::shared_ptr<CWallet>& wallet) : m_shared_wallet(wallet), m_wallet(*wallet.get()) {} explicit WalletImpl(const std::shared_ptr<CWallet>& wallet) : m_shared_wallet(wallet), m_wallet(*wallet.get()) {}
bool encryptWallet(const SecureString& wallet_passphrase) override bool encryptWallet(const SecureString& wallet_passphrase) override
{ {

View file

@ -24,7 +24,7 @@ private:
const CChainParams& m_params; const CChainParams& m_params;
public: public:
DestinationEncoder(const CChainParams& params) : m_params(params) {} explicit DestinationEncoder(const CChainParams& params) : m_params(params) {}
std::string operator()(const CKeyID& id) const std::string operator()(const CKeyID& id) const
{ {

View file

@ -71,7 +71,7 @@ public:
QList<AddressTableEntry> cachedAddressTable; QList<AddressTableEntry> cachedAddressTable;
AddressTableModel *parent; AddressTableModel *parent;
AddressTablePriv(AddressTableModel *_parent): explicit AddressTablePriv(AddressTableModel *_parent):
parent(_parent) {} parent(_parent) {}
void refreshAddressTable(interfaces::Wallet& wallet) void refreshAddressTable(interfaces::Wallet& wallet)

View file

@ -82,7 +82,7 @@ class RPCExecutor : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
RPCExecutor(interfaces::Node& node) : m_node(node) {} explicit RPCExecutor(interfaces::Node& node) : m_node(node) {}
public Q_SLOTS: public Q_SLOTS:
void request(const QString &command, const QString &walletID); void request(const QString &command, const QString &walletID);

View file

@ -58,7 +58,7 @@ struct TxLessThan
class TransactionTablePriv class TransactionTablePriv
{ {
public: public:
TransactionTablePriv(TransactionTableModel *_parent) : explicit TransactionTablePriv(TransactionTableModel *_parent) :
parent(_parent) parent(_parent)
{ {
} }

View file

@ -29,7 +29,7 @@ BOOST_FIXTURE_TEST_SUITE(miner_tests, TestingSetup)
// BOOST_CHECK_EXCEPTION predicates to check the specific validation error // BOOST_CHECK_EXCEPTION predicates to check the specific validation error
class HasReason { class HasReason {
public: public:
HasReason(const std::string& reason) : m_reason(reason) {} explicit HasReason(const std::string& reason) : m_reason(reason) {}
bool operator() (const std::runtime_error& e) const { bool operator() (const std::runtime_error& e) const {
return std::string(e.what()).find(m_reason) != std::string::npos; return std::string(e.what()).find(m_reason) != std::string::npos;
}; };

View file

@ -23,7 +23,7 @@ BOOST_FIXTURE_TEST_SUITE(validation_block_tests, RegtestingSetup)
struct TestSubscriber : public CValidationInterface { struct TestSubscriber : public CValidationInterface {
uint256 m_expected_tip; uint256 m_expected_tip;
TestSubscriber(uint256 tip) : m_expected_tip(tip) {} explicit TestSubscriber(uint256 tip) : m_expected_tip(tip) {}
void UpdatedBlockTip(const CBlockIndex* pindexNew, const CBlockIndex* pindexFork, bool fInitialDownload) override void UpdatedBlockTip(const CBlockIndex* pindexNew, const CBlockIndex* pindexFork, bool fInitialDownload) override
{ {