From 1841d93ccbe5792a17f5b9a22e65ec898c7c2668 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 19 May 2020 19:04:08 +0100 Subject: style(3p/nix): Add braces around single-line for-loops These were not caught by the previous clang-tidy invocation, but were instead sorted out using amber[0] as such: ambr --regex 'for (\(.+\))\s([a-z].*;)' 'for $1 { $2 }' [0]: https://github.com/dalance/amber --- third_party/nix/src/nix-build/nix-build.cc | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'third_party/nix/src/nix-build') diff --git a/third_party/nix/src/nix-build/nix-build.cc b/third_party/nix/src/nix-build/nix-build.cc index 8fcfbe78d8..b5368a65db 100644 --- a/third_party/nix/src/nix-build/nix-build.cc +++ b/third_party/nix/src/nix-build/nix-build.cc @@ -102,7 +102,9 @@ static void _main(int argc, char** argv) { "IN_NIX_SHELL", "TZ", "PAGER", "NIX_BUILD_SHELL", "SHLVL"}; Strings args; - for (int i = 1; i < argc; ++i) args.push_back(argv[i]); + for (int i = 1; i < argc; ++i) { + args.push_back(argv[i]); + } // Heuristic to see if we're invoked as a shebang script, namely, // if we have at least one argument, it's the name of an @@ -115,7 +117,9 @@ static void _main(int argc, char** argv) { if (std::regex_search(lines.front(), std::regex("^#!"))) { lines.pop_front(); inShebang = true; - for (int i = 2; i < argc; ++i) savedArgs.push_back(argv[i]); + for (int i = 2; i < argc; ++i) { + savedArgs.push_back(argv[i]); + } args.clear(); for (auto line : lines) { line = chomp(line); @@ -210,7 +214,9 @@ static void _main(int argc, char** argv) { execArgs = "-a PERL"; std::ostringstream joined; - for (const auto& i : savedArgs) joined << shellEscape(i) << ' '; + for (const auto& i : savedArgs) { + joined << shellEscape(i) << ' '; + } if (std::regex_search(interpreter, std::regex("ruby"))) { // Hack for Ruby. Ruby also examines the shebang. It tries to @@ -260,7 +266,9 @@ static void _main(int argc, char** argv) { std::ostringstream joined; joined << "with import { }; (pkgs.runCommandCC or " "pkgs.runCommand) \"shell\" { buildInputs = [ "; - for (const auto& i : left) joined << '(' << i << ") "; + for (const auto& i : left) { + joined << '(' << i << ") "; + } joined << "]; } \"\""; fromArgs = true; left = {joined.str()}; @@ -389,7 +397,9 @@ static void _main(int argc, char** argv) { std::regex(exclude)); })) pathsToBuild.insert(makeDrvPathWithOutputs(input.first, input.second)); - for (const auto& src : drv.inputSrcs) pathsToBuild.insert(src); + for (const auto& src : drv.inputSrcs) { + pathsToBuild.insert(src); + } buildPaths(pathsToBuild); @@ -465,7 +475,9 @@ static void _main(int argc, char** argv) { envCommand)); Strings envStrs; - for (auto& i : env) envStrs.push_back(i.first + "=" + i.second); + for (auto& i : env) { + envStrs.push_back(i.first + "=" + i.second); + } auto args = interactive ? Strings{"bash", "--rcfile", rcfile} : Strings{"bash", rcfile}; @@ -531,7 +543,9 @@ static void _main(int argc, char** argv) { if (auto store2 = store.dynamic_pointer_cast()) store2->addPermRoot(symlink.second, absPath(symlink.first), true); - for (auto& path : outPaths) std::cout << path << '\n'; + for (auto& path : outPaths) { + std::cout << path << '\n'; + } } } -- cgit 1.4.1