diff --git a/src/tests/htmlparser_cpp_test.cc b/src/tests/htmlparser_cpp_test.cc
index 47c65c1..c0f71b5 100644
--- a/src/tests/htmlparser_cpp_test.cc
+++ b/src/tests/htmlparser_cpp_test.cc
@@ -500,12 +500,12 @@ void HtmlparserCppTest::ProcessAnnotation(const string &annotation) {
} else if (iter->first.compare("is_url_start") == 0) {
ValidateIsUrlStart(iter->second);
} else if (iter->first.compare("save_context") == 0) {
- if (contextMap.find(iter->second) == contextMap.end()) {
+ if (!contextMap.count(iter->second)) {
contextMap[iter->second] = new HtmlParser();
}
contextMap[iter->second]->CopyFrom(&parser_);
} else if (iter->first.compare("load_context") == 0) {
- CHECK(contextMap.find(iter->second) != contextMap.end());
+ CHECK(contextMap.count(iter->second));
parser_.CopyFrom(contextMap[iter->second]);
} else if (iter->first.compare("reset") == 0) {
if (StringToBool(iter->second)) {
diff --git a/src/tests/template_unittest.cc b/src/tests/template_unittest.cc
index 60edbb7..8d615c0 100644
--- a/src/tests/template_unittest.cc
+++ b/src/tests/template_unittest.cc
@@ -1455,10 +1455,10 @@ TEST(Template, TemplateNamelist) {
TemplateNamelist::NameListType names = TemplateNamelist::GetList();
ASSERT(names.size() == 4);
- ASSERT(names.find(NONEXISTENT_FN) != names.end());
- ASSERT(names.find(INVALID1_FN) != names.end());
- ASSERT(names.find(INVALID2_FN) != names.end());
- ASSERT(names.find(VALID1_FN) != names.end());
+ ASSERT(names.count(NONEXISTENT_FN));
+ ASSERT(names.count(INVALID1_FN));
+ ASSERT(names.count(INVALID2_FN));
+ ASSERT(names.count(VALID1_FN));
// Before creating the files INVALID1_FN, etc., all should be missing.
for (int i = 0; i < 3; ++i) { // should be consistent all 3 times