refactor: enable readability-container-contains clang-tidy rule

Replace the last few instances of `.count() != 0` and `.count() == 0` and `.count()` patterns with the more expressive C++20 `.contains()` method:

* `std::set<std::string>` in `getblocktemplate` RPC;
* `std::map<std::string, ...>` in `transaction_tests`;
* other bare `std::unordered_set` and `std::map` count calls.

With no remaining violations, enable the `readability-container-contains`
clang-tidy check to prevent future regressions.
This commit is contained in:
Lőrinc committed 2025-12-18 22:38:02 +01:00
1 parent fd9f1accbd
commit 1e94e562f7
5 files changed
+11 -10

No files matched your search

+1 -1
View File
@@ -125,7 +125,7 @@ FUZZ_TARGET(scriptpubkeyman, .init = initialize_spkm)
[&] {
const CScript script{ConsumeScript(fuzzed_data_provider)};
if (spk_manager->IsMine(script)) {
assert(spk_manager->GetScriptPubKeys().count(script));
assert(spk_manager->GetScriptPubKeys().contains(script));
}
},
[&] {