diff --git a/src/.clang-tidy b/src/.clang-tidy index b2c1b49588..dc26a640b6 100644 --- a/src/.clang-tidy +++ b/src/.clang-tidy @@ -5,6 +5,7 @@ bugprone-use-after-move, misc-unused-using-decls, modernize-use-default-member-init, modernize-use-nullptr, +performance-faster-string-find, performance-for-range-copy, performance-move-const-arg, performance-no-automatic-move, diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp index a1020c3b2b..ae1440c70b 100644 --- a/src/rpc/util.cpp +++ b/src/rpc/util.cpp @@ -732,12 +732,12 @@ UniValue RPCArg::MatchesType(const UniValue& request) const std::string RPCArg::GetFirstName() const { - return m_names.substr(0, m_names.find("|")); + return m_names.substr(0, m_names.find('|')); } std::string RPCArg::GetName() const { - CHECK_NONFATAL(std::string::npos == m_names.find("|")); + CHECK_NONFATAL(std::string::npos == m_names.find('|')); return m_names; } diff --git a/src/util/bip32.cpp b/src/util/bip32.cpp index c4b7120394..c0ad9257ce 100644 --- a/src/util/bip32.cpp +++ b/src/util/bip32.cpp @@ -25,7 +25,7 @@ bool ParseHDKeypath(const std::string& keypath_str, std::vector& keypa } // Finds whether it is hardened uint32_t path = 0; - size_t pos = item.find("'"); + size_t pos = item.find('\''); if (pos != std::string::npos) { // The hardened tick can only be in the last index of the string if (pos != item.size() - 1) { diff --git a/src/zmq/zmqpublishnotifier.cpp b/src/zmq/zmqpublishnotifier.cpp index 6418455d19..55f3d4e934 100644 --- a/src/zmq/zmqpublishnotifier.cpp +++ b/src/zmq/zmqpublishnotifier.cpp @@ -96,7 +96,7 @@ static bool IsZMQAddressIPV6(const std::string &zmq_address) { const std::string tcp_prefix = "tcp://"; const size_t tcp_index = zmq_address.rfind(tcp_prefix); - const size_t colon_index = zmq_address.rfind(":"); + const size_t colon_index = zmq_address.rfind(':'); if (tcp_index == 0 && colon_index != std::string::npos) { const std::string ip = zmq_address.substr(tcp_prefix.length(), colon_index - tcp_prefix.length()); CNetAddr addr;