Internal Code Change

PiperOrigin-RevId: 518213370
Change-Id: I88d0acc195dadf8d03cd15c8534c721141db14ea
This commit is contained in:
Abseil Team 2023-03-21 02:35:52 -07:00 committed by Copybara-Service
parent fa87209829
commit e9faae170f

View File

@ -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<PairType> {
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<PairType> {
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 ";