diff options
author | Vincent Ambo <tazjin@google.com> | 2020-05-19T18·04+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-05-19T18·04+0100 |
commit | 1841d93ccbe5792a17f5b9a22e65ec898c7c2668 (patch) | |
tree | f31155746ad5a21a6f10172b3edaf79b74b56819 /third_party/nix/src/nix/run.cc | |
parent | 867055133d3f487e52dd44149f76347c2c28bf10 (diff) |
style(3p/nix): Add braces around single-line for-loops r/772
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
Diffstat (limited to 'third_party/nix/src/nix/run.cc')
-rw-r--r-- | third_party/nix/src/nix/run.cc | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/third_party/nix/src/nix/run.cc b/third_party/nix/src/nix/run.cc index c246767ceddd..64b883b9a316 100644 --- a/third_party/nix/src/nix/run.cc +++ b/third_party/nix/src/nix/run.cc @@ -101,19 +101,25 @@ struct CmdRun : InstallablesCommand { clearEnv(); - for (auto& var : kept) setenv(var.first.c_str(), var.second.c_str(), 1); + for (auto& var : kept) { + setenv(var.first.c_str(), var.second.c_str(), 1); + } } else { if (!keep.empty()) throw UsageError( "--keep does not make sense without --ignore-environment"); - for (auto& var : unset) unsetenv(var.c_str()); + for (auto& var : unset) { + unsetenv(var.c_str()); + } } std::unordered_set<Path> done; std::queue<Path> todo; - for (auto& path : outPaths) todo.push(path); + for (auto& path : outPaths) { + todo.push(path); + } auto unixPath = tokenizeString<Strings>(getEnv("PATH"), ":"); @@ -130,7 +136,9 @@ struct CmdRun : InstallablesCommand { auto propPath = path + "/nix-support/propagated-user-env-packages"; if (accessor->stat(propPath).type == FSAccessor::tRegular) { - for (auto& p : tokenizeString<Paths>(readFile(propPath))) todo.push(p); + for (auto& p : tokenizeString<Paths>(readFile(propPath))) { + todo.push(p); + } } } @@ -138,7 +146,9 @@ struct CmdRun : InstallablesCommand { std::string cmd = *command.begin(); Strings args; - for (auto& arg : command) args.push_back(arg); + for (auto& arg : command) { + args.push_back(arg); + } restoreSignals(); @@ -157,7 +167,9 @@ struct CmdRun : InstallablesCommand { if (store2 && store->storeDir != store2->realStoreDir) { Strings helperArgs = {chrootHelperName, store->storeDir, store2->realStoreDir, cmd}; - for (auto& arg : args) helperArgs.push_back(arg); + for (auto& arg : args) { + helperArgs.push_back(arg); + } execv(readLink("/proc/self/exe").c_str(), stringsToCharPtrs(helperArgs).data()); |