From 2bd3758a22131cfd6925b3fd995657b211095c90 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 1 May 2019 14:48:41 -0700 Subject: clang-tidy braces changes (#2075) Applies the changes in #2065, and temprarily disables the hook since it's too slow to run on a change this large. We should re-enable it in a later commit. --- src/support/command-line.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/support/command-line.cpp') diff --git a/src/support/command-line.cpp b/src/support/command-line.cpp index f3b9ffe25..f1b4fca4d 100644 --- a/src/support/command-line.cpp +++ b/src/support/command-line.cpp @@ -37,8 +37,9 @@ void printWrap(std::ostream& os, int leftPad, const std::string& content) { } os << nextWord; space -= nextWord.size() + 1; - if (space > 0) + if (space > 0) { os << ' '; + } nextWord.clear(); if (content[i] == '\n') { os << '\n'; @@ -56,8 +57,9 @@ Options::Options(const std::string& command, const std::string& description) Arguments::Zero, [this, command, description](Options* o, const std::string&) { std::cout << command; - if (positional != Arguments::Zero) + if (positional != Arguments::Zero) { std::cout << ' ' << positionalName; + } std::cout << "\n\n"; printWrap(std::cout, 0, description); std::cout << "\n\nOptions:\n"; @@ -109,8 +111,9 @@ void Options::parse(int argc, const char* argv[]) { size_t positionalsSeen = 0; auto dashes = [](const std::string& s) { for (size_t i = 0;; ++i) { - if (s[i] != '-') + if (s[i] != '-') { return i; + } } }; for (size_t i = 1, e = argc; i != e; ++i) { @@ -147,9 +150,11 @@ void Options::parse(int argc, const char* argv[]) { currentOption = currentOption.substr(0, equal); } Option* option = nullptr; - for (auto& o : options) - if (o.longName == currentOption || o.shortName == currentOption) + for (auto& o : options) { + if (o.longName == currentOption || o.shortName == currentOption) { option = &o; + } + } if (!option) { std::cerr << "Unknown option '" << currentOption << "'\n"; exit(EXIT_FAILURE); @@ -181,8 +186,9 @@ void Options::parse(int argc, const char* argv[]) { break; case Arguments::Optional: if (!argument.size()) { - if (i + 1 != e) + if (i + 1 != e) { argument = argv[++i]; + } } break; } -- cgit v1.2.3