diff options
author | Michael Shields <mshields@google.com> | 2019-06-20T18·54-0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-20T18·54-0700 |
commit | 23dc75953839cb4e47c9d3624b7111ea4facb807 (patch) | |
tree | e6e81e8347b7b912ee9c8f038d7e59d79d7493a4 /absl/flags | |
parent | 43ef2148c0936ebf7cb4be6b19927a9d9d145b8f (diff) |
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().
Diffstat (limited to 'absl/flags')
-rw-r--r-- | absl/flags/marshalling.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/absl/flags/marshalling.h b/absl/flags/marshalling.h index 7eb75cde7623..7a323729738e 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 |