style(3p/nix): Add braces around single-line conditionals

These were not caught by the previous clang-tidy invocation, but were
instead sorted out using amber[0] as such:

    ambr --regex 'if (\(.+\))\s([a-z].*;)' 'if $1 { $2 }'

[0]: https://github.com/dalance/amber
This commit is contained in:
Vincent Ambo 2020-05-19 18:55:58 +01:00
parent c6a31838cd
commit 867055133d
97 changed files with 2223 additions and 753 deletions

View file

@ -111,7 +111,9 @@ static void prim_getContext(EvalState& state, const Pos& pos, Value** args,
for (const auto& info : contextInfos) {
auto& infoVal = *state.allocAttr(v, state.symbols.create(info.first));
state.mkAttrs(infoVal, 3);
if (info.second.path) mkBool(*state.allocAttr(infoVal, sPath), true);
if (info.second.path) {
mkBool(*state.allocAttr(infoVal, sPath), true);
}
if (info.second.allOutputs)
mkBool(*state.allocAttr(infoVal, sAllOutputs), true);
if (!info.second.outputs.empty()) {
@ -147,11 +149,15 @@ static void prim_appendContext(EvalState& state, const Pos& pos, Value** args,
if (!state.store->isStorePath(i.name))
throw EvalError("Context key '%s' is not a store path, at %s", i.name,
i.pos);
if (!settings.readOnlyMode) state.store->ensurePath(i.name);
if (!settings.readOnlyMode) {
state.store->ensurePath(i.name);
}
state.forceAttrs(*i.value, *i.pos);
auto iter = i.value->attrs->find(sPath);
if (iter != i.value->attrs->end()) {
if (state.forceBool(*iter->value, *iter->pos)) context.insert(i.name);
if (state.forceBool(*iter->value, *iter->pos)) {
context.insert(i.name);
}
}
iter = i.value->attrs->find(sAllOutputs);