Skip to content

Commit 1e62350

Browse files
committed
refactor: Improve use of explicit keyword
1 parent c502a6d commit 1e62350

19 files changed

+31
-22
lines changed

src/net_processing.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ struct Peer {
451451
/** Work queue of items requested by this peer **/
452452
std::deque<CInv> m_getdata_requests GUARDED_BY(m_getdata_requests_mutex);
453453

454-
Peer(NodeId id) : m_id(id) {}
454+
explicit Peer(NodeId id) : m_id(id) {}
455455
};
456456

457457
using PeerRef = std::shared_ptr<Peer>;

src/node/interfaces.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ namespace {
6464
class NodeImpl : public Node
6565
{
6666
public:
67-
NodeImpl(NodeContext* context) { setContext(context); }
67+
explicit NodeImpl(NodeContext* context) { setContext(context); }
6868
void initLogging() override { InitLogging(*Assert(m_context->args)); }
6969
void initParameterInteraction() override { InitParameterInteraction(*Assert(m_context->args)); }
7070
bilingual_str getWarnings() override { return GetWarnings(true); }

src/pubkey.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ class XOnlyPubKey
223223

224224
public:
225225
/** Construct an x-only pubkey from exactly 32 bytes. */
226-
XOnlyPubKey(Span<const unsigned char> bytes);
226+
explicit XOnlyPubKey(Span<const unsigned char> bytes);
227227

228228
/** Verify a Schnorr signature against this public key.
229229
*

src/qt/test/addressbooktests.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Node;
1515
class AddressBookTests : public QObject
1616
{
1717
public:
18-
AddressBookTests(interfaces::Node& node) : m_node(node) {}
18+
explicit AddressBookTests(interfaces::Node& node) : m_node(node) {}
1919
interfaces::Node& m_node;
2020

2121
Q_OBJECT

src/qt/test/rpcnestedtests.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Node;
1515
class RPCNestedTests : public QObject
1616
{
1717
public:
18-
RPCNestedTests(interfaces::Node& node) : m_node(node) {}
18+
explicit RPCNestedTests(interfaces::Node& node) : m_node(node) {}
1919
interfaces::Node& m_node;
2020

2121
Q_OBJECT

src/qt/test/wallettests.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Node;
1515
class WalletTests : public QObject
1616
{
1717
public:
18-
WalletTests(interfaces::Node& node) : m_node(node) {}
18+
explicit WalletTests(interfaces::Node& node) : m_node(node) {}
1919
interfaces::Node& m_node;
2020

2121
Q_OBJECT

src/rpc/request.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class JSONRPCRequest
4040
std::string peerAddr;
4141
const util::Ref& context;
4242

43-
JSONRPCRequest(const util::Ref& context) : id(NullUniValue), params(NullUniValue), fHelp(false), context(context) {}
43+
explicit JSONRPCRequest(const util::Ref& context) : id(NullUniValue), params(NullUniValue), fHelp(false), context(context) {}
4444

4545
//! Initializes request information from another request object and the
4646
//! given context. The implementation should be updated if any members are

src/script/descriptor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ struct PubkeyProvider
156156
uint32_t m_expr_index;
157157

158158
public:
159-
PubkeyProvider(uint32_t exp_index) : m_expr_index(exp_index) {}
159+
explicit PubkeyProvider(uint32_t exp_index) : m_expr_index(exp_index) {}
160160

161161
virtual ~PubkeyProvider() = default;
162162

src/script/standard.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class BaseHash
2828

2929
public:
3030
BaseHash() : m_hash() {}
31-
BaseHash(const HashType& in) : m_hash(in) {}
31+
explicit BaseHash(const HashType& in) : m_hash(in) {}
3232

3333
unsigned char* begin()
3434
{

src/test/fuzz/signature_checker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class FuzzedSignatureChecker : public BaseSignatureChecker
2424
FuzzedDataProvider& m_fuzzed_data_provider;
2525

2626
public:
27-
FuzzedSignatureChecker(FuzzedDataProvider& fuzzed_data_provider) : m_fuzzed_data_provider(fuzzed_data_provider)
27+
explicit FuzzedSignatureChecker(FuzzedDataProvider& fuzzed_data_provider) : m_fuzzed_data_provider(fuzzed_data_provider)
2828
{
2929
}
3030

0 commit comments

Comments
 (0)