diff options
author | Michael Diamond <diamondm@google.com> | 2022-11-06 06:50:28 -0800 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2022-11-06 06:51:21 -0800 |
commit | 1ee0ea84893e7d1edfc4fdaf192a0551a46e20b4 (patch) | |
tree | db86e8197adca777efe0c065e151b9f10dc07b26 | |
parent | ce1d3484756e20ce96f6404eb62362c87fbd584a (diff) |
Fix a few lint findings in flags' usage.cc
PiperOrigin-RevId: 486480813
Change-Id: I05292dd0550dfb4130bbe47eafa96ff5b58c040b
-rw-r--r-- | absl/flags/internal/usage.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/absl/flags/internal/usage.cc b/absl/flags/internal/usage.cc index a3b13ed3..5efc7b07 100644 --- a/absl/flags/internal/usage.cc +++ b/absl/flags/internal/usage.cc @@ -17,7 +17,9 @@ #include <stdint.h> +#include <algorithm> #include <functional> +#include <iterator> #include <map> #include <ostream> #include <string> @@ -33,6 +35,7 @@ #include "absl/flags/internal/program_name.h" #include "absl/flags/internal/registry.h" #include "absl/flags/usage_config.h" +#include "absl/strings/match.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_split.h" #include "absl/strings/string_view.h" @@ -343,7 +346,7 @@ void FlagHelp(std::ostream& out, const CommandLineFlag& flag, void FlagsHelp(std::ostream& out, absl::string_view filter, HelpFormat format, absl::string_view program_usage_message) { flags_internal::FlagKindFilter filter_cb = [&](absl::string_view filename) { - return filter.empty() || filename.find(filter) != absl::string_view::npos; + return filter.empty() || absl::StrContains(filename, filter); }; flags_internal::FlagsHelpImpl(out, filter_cb, format, program_usage_message); } @@ -465,7 +468,7 @@ void SetFlagsHelpFormat(HelpFormat format) { // function. bool DeduceUsageFlags(absl::string_view name, absl::string_view value) { if (absl::ConsumePrefix(&name, "help")) { - if (name == "") { + if (name.empty()) { if (value.empty()) { SetFlagsHelpMode(HelpMode::kImportant); } else { |