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/repl.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/repl.cc')
-rw-r--r-- | third_party/nix/src/nix/repl.cc | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/third_party/nix/src/nix/repl.cc b/third_party/nix/src/nix/repl.cc index 0297cca84854..f6b62d0ca2d2 100644 --- a/third_party/nix/src/nix/repl.cc +++ b/third_party/nix/src/nix/repl.cc @@ -200,7 +200,9 @@ static int listPossibleCallback(char* s, char*** avp) { vp = check((char**)malloc(possible.size() * sizeof(char*))); - for (auto& p : possible) vp[ac++] = check(strdup(p.c_str())); + for (auto& p : possible) { + vp[ac++] = check(strdup(p.c_str())); + } *avp = vp; @@ -221,7 +223,9 @@ void NixRepl::mainLoop(const std::vector<std::string>& files) { << std::endl << std::endl; - for (auto& i : files) loadedFiles.push_back(i); + for (auto& i : files) { + loadedFiles.push_back(i); + } reloadFiles(); if (!loadedFiles.empty()) { @@ -576,7 +580,9 @@ void NixRepl::initEnv() { staticEnv.vars.clear(); varNames.clear(); - for (auto& i : state.staticBaseEnv.vars) varNames.insert(i.first); + for (auto& i : state.staticBaseEnv.vars) { + varNames.insert(i.first); + } } void NixRepl::reloadFiles() { @@ -598,7 +604,9 @@ void NixRepl::reloadFiles() { void NixRepl::addAttrsToScope(Value& attrs) { state.forceAttrs(attrs); - for (auto& i : *attrs.attrs) addVarToScope(i.name, *i.value); + for (auto& i : *attrs.attrs) { + addVarToScope(i.name, *i.value); + } std::cout << format("Added %1% variables.") % attrs.attrs->size() << std::endl; } @@ -696,7 +704,9 @@ std::ostream& NixRepl::printValue(std::ostream& str, Value& v, typedef std::map<string, Value*> Sorted; Sorted sorted; - for (auto& i : *v.attrs) sorted[i.name] = i.value; + for (auto& i : *v.attrs) { + sorted[i.name] = i.value; + } for (auto& i : sorted) { if (isVarName(i.first)) |