From 23dc75953839cb4e47c9d3624b7111ea4facb807 Mon Sep 17 00:00:00 2001 From: Michael Shields Date: Thu, 20 Jun 2019 11:54:01 -0700 Subject: [PATCH] Improve example AbslUnparseFlag(). 1. Move default case outside switch. This is a good practice because it allows -Wswitch to warn about missing enum values. 2. Use absl::StrCat() instead of (nonexistent) SimpleItoa(). --- absl/flags/marshalling.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/absl/flags/marshalling.h b/absl/flags/marshalling.h index 7eb75cde..7a323729 100644 --- a/absl/flags/marshalling.h +++ b/absl/flags/marshalling.h @@ -106,10 +106,10 @@ // // Returns a textual flag value corresponding to the OutputMode `mode`. // std::string AbslUnparseFlag(OutputMode mode) { // switch (mode) { -// case kPlainText: return "plaintext"; -// case kHtml: return "html"; -// default: return SimpleItoa(mode); +// case kPlainText: return "plaintext"; +// case kHtml: return "html"; // } +// return absl::SimpleItoa(mode); // } // // Notice that neither `AbslParseFlag()` nor `AbslUnparseFlag()` are class