diff --git a/lib/checkstl.cpp b/lib/checkstl.cpp index 22caed155..e28e65043 100644 --- a/lib/checkstl.cpp +++ b/lib/checkstl.cpp @@ -845,11 +845,10 @@ void CheckStl::redundantCondition() void CheckStl::redundantIfRemoveError(const Token *tok) { - reportError(tok, Severity::style, "redundantIfRemove", "Redundant condition. The remove function in the STL will not do anything if element doesn't exist"); + reportError(tok, Severity::style, "redundantIfRemove", "Redundant checking of STL container element.\n" + "The remove method in the STL will not do anything if element doesn't exist"); } - - void CheckStl::missingComparison() { for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next()) diff --git a/test/teststl.cpp b/test/teststl.cpp index 764e00e3e..b045f22e5 100644 --- a/test/teststl.cpp +++ b/test/teststl.cpp @@ -1044,7 +1044,7 @@ private: " if (haystack.find(needle) != haystack.end())\n" " haystack.remove(needle);" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Redundant condition. The remove function in the STL will not do anything if element doesn't exist\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Redundant checking of STL container element.\n", errout.str()); } void redundantCondition2() @@ -1056,7 +1056,7 @@ private: " haystack.remove(needle);\n" " }\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Redundant condition. The remove function in the STL will not do anything if element doesn't exist\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Redundant checking of STL container element.\n", errout.str()); } void missingInnerComparison1()