Fix a few lint findings in flags' usage.cc

PiperOrigin-RevId: 486480813
Change-Id: I05292dd0550dfb4130bbe47eafa96ff5b58c040b
pull/1290/merge
Michael Diamond 2 years ago committed by Copybara-Service
parent ce1d348475
commit 1ee0ea8489
  1. 7
      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 {

Loading…
Cancel
Save