From e9faae170f8ab3086a76c299f19d659ba6079967 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Tue, 21 Mar 2023 02:35:52 -0700 Subject: [PATCH] Internal Code Change PiperOrigin-RevId: 518213370 Change-Id: I88d0acc195dadf8d03cd15c8534c721141db14ea --- googlemock/include/gmock/gmock-matchers.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h index a480576d..7c5d65cf 100644 --- a/googlemock/include/gmock/gmock-matchers.h +++ b/googlemock/include/gmock/gmock-matchers.h @@ -563,7 +563,7 @@ namespace internal { // If the explanation is not empty, prints it to the ostream. inline void PrintIfNotEmpty(const std::string& explanation, ::std::ostream* os) { - if (explanation != "" && os != nullptr) { + if (!explanation.empty() && os != nullptr) { *os << ", " << explanation; } } @@ -2966,7 +2966,7 @@ class KeyMatcherImpl : public MatcherInterface { const bool match = inner_matcher_.MatchAndExplain( pair_getters::First(key_value, Rank0()), &inner_listener); const std::string explanation = inner_listener.str(); - if (explanation != "") { + if (!explanation.empty()) { *listener << "whose first field is a value " << explanation; } return match; @@ -3113,12 +3113,12 @@ class PairMatcherImpl : public MatcherInterface { const std::string& second_explanation, MatchResultListener* listener) const { *listener << "whose both fields match"; - if (first_explanation != "") { + if (!first_explanation.empty()) { *listener << ", where the first field is a value " << first_explanation; } - if (second_explanation != "") { + if (!second_explanation.empty()) { *listener << ", "; - if (first_explanation != "") { + if (!first_explanation.empty()) { *listener << "and "; } else { *listener << "where ";