diff options
author | MacroFake <falke.marco@gmail.com> | 2022-07-26 17:47:50 +0200 |
---|---|---|
committer | MacroFake <falke.marco@gmail.com> | 2022-07-26 17:47:55 +0200 |
commit | 7f79746bf046d0028bb68f265804b9774dec2acb (patch) | |
tree | 933234af65f8d6aafdc3c7953f0e11c759acc24c | |
parent | 567121747712612434223679d77557a7edf0fe56 (diff) | |
parent | 49168df073d465450b1da4a506ac7ea24fbbb877 (diff) |
Merge bitcoin/bitcoin#25705: tidy: enable readability-redundant-string-init
49168df073d465450b1da4a506ac7ea24fbbb877 tidy: enable readability-redundant-string-init (fanquake)
4ddd746bf9714a209b2f82918a70c4fe81d895c9 refactor: remove unnecessary string initializations (fanquake)
Pull request description:
Remove unnecessary `std::string` = "" initializations. Enable `readability-redundant-string-init`.
See:
https://releases.llvm.org/14.0.0/tools/clang/tools/extra/docs/clang-tidy/checks/readability-redundant-string-init.html
ACKs for top commit:
shaavan:
ACK 49168df073d465450b1da4a506ac7ea24fbbb87
Tree-SHA512: 69e72a434908c9166d407551657b310361ae2ef0170f8289cb1c2b8e96a4632be718c0d55cb12af03a3c3d621d9583eced88e5e9d924abb0a8b1a9b36c903d66
-rw-r--r-- | src/.clang-tidy | 2 | ||||
-rw-r--r-- | src/blockfilter.cpp | 2 | ||||
-rw-r--r-- | src/external_signer.cpp | 2 | ||||
-rw-r--r-- | src/util/system.cpp | 2 | ||||
-rw-r--r-- | src/wallet/rpc/backup.cpp | 2 | ||||
-rw-r--r-- | src/wallet/rpc/wallet.cpp | 2 |
6 files changed, 7 insertions, 5 deletions
diff --git a/src/.clang-tidy b/src/.clang-tidy index df2a080075..b9371b147b 100644 --- a/src/.clang-tidy +++ b/src/.clang-tidy @@ -5,6 +5,7 @@ misc-unused-using-decls, modernize-use-default-member-init, modernize-use-nullptr, readability-redundant-declaration, +readability-redundant-string-init, ' WarningsAsErrors: ' bugprone-argument-comment, @@ -12,4 +13,5 @@ misc-unused-using-decls, modernize-use-default-member-init, modernize-use-nullptr, readability-redundant-declaration, +readability-redundant-string-init, ' diff --git a/src/blockfilter.cpp b/src/blockfilter.cpp index 1ad6872143..0ff79bb3ca 100644 --- a/src/blockfilter.cpp +++ b/src/blockfilter.cpp @@ -148,7 +148,7 @@ bool GCSFilter::MatchAny(const ElementSet& elements) const const std::string& BlockFilterTypeName(BlockFilterType filter_type) { - static std::string unknown_retval = ""; + static std::string unknown_retval; auto it = g_filter_types.find(filter_type); return it != g_filter_types.end() ? it->second : unknown_retval; } diff --git a/src/external_signer.cpp b/src/external_signer.cpp index d125fe479b..6bab0a856c 100644 --- a/src/external_signer.cpp +++ b/src/external_signer.cpp @@ -49,7 +49,7 @@ bool ExternalSigner::Enumerate(const std::string& command, std::vector<ExternalS if (signer.m_fingerprint.compare(fingerprintStr) == 0) duplicate = true; } if (duplicate) break; - std::string name = ""; + std::string name; const UniValue& model_field = find_value(signer, "model"); if (model_field.isStr() && model_field.getValStr() != "") { name += model_field.getValStr(); diff --git a/src/util/system.cpp b/src/util/system.cpp index f6f2828fc8..ce45fb2ed4 100644 --- a/src/util/system.cpp +++ b/src/util/system.cpp @@ -740,7 +740,7 @@ std::string ArgsManager::GetHelpMessage() const { const bool show_debug = GetBoolArg("-help-debug", false); - std::string usage = ""; + std::string usage; LOCK(cs_args); for (const auto& arg_map : m_available_args) { switch(arg_map.first) { diff --git a/src/wallet/rpc/backup.cpp b/src/wallet/rpc/backup.cpp index 57c3bcc68b..306053fd0c 100644 --- a/src/wallet/rpc/backup.cpp +++ b/src/wallet/rpc/backup.cpp @@ -140,7 +140,7 @@ RPCHelpMan importprivkey() EnsureWalletIsUnlocked(*pwallet); std::string strSecret = request.params[0].get_str(); - std::string strLabel = ""; + std::string strLabel; if (!request.params[1].isNull()) strLabel = request.params[1].get_str(); diff --git a/src/wallet/rpc/wallet.cpp b/src/wallet/rpc/wallet.cpp index b474236e58..0fe8871152 100644 --- a/src/wallet/rpc/wallet.cpp +++ b/src/wallet/rpc/wallet.cpp @@ -241,7 +241,7 @@ static RPCHelpMan loadwallet() static RPCHelpMan setwalletflag() { - std::string flags = ""; + std::string flags; for (auto& it : WALLET_FLAG_MAP) if (it.second & MUTABLE_WALLET_FLAGS) flags += (flags == "" ? "" : ", ") + it.first; |