style(3p/nix): Final act in the brace-wrapping saga

This last change set was generated by a full clang-tidy run (including
compilation):

    clang-tidy -p ~/projects/nix-build/ \
      -checks=-*,readability-braces-around-statements -fix src/*/*.cc

Actually running clang-tidy requires some massaging to make it play
nice with Nix + meson, I'll be adding a wrapper or something for that soon.
This commit is contained in:
Vincent Ambo 2020-05-19 20:47:23 +01:00
parent cf40d08908
commit 3908732181
84 changed files with 2601 additions and 1554 deletions

View file

@ -16,16 +16,18 @@ static Strings parseAttrPath(const string& s) {
} else if (*i == '"') {
++i;
while (1) {
if (i == s.end())
if (i == s.end()) {
throw Error(format("missing closing quote in selection path '%1%'") %
s);
}
if (*i == '"') {
break;
}
cur.push_back(*i++);
}
} else
} else {
cur.push_back(*i);
}
++i;
}
if (!cur.empty()) {
@ -62,33 +64,38 @@ Value* findAlongAttrPath(EvalState& state, const string& attrPath,
according to what is specified in the attrPath. */
if (apType == apAttr) {
if (v->type != tAttrs)
if (v->type != tAttrs) {
throw TypeError(format("the expression selected by the selection path "
"'%1%' should be a set but is %2%") %
attrPath % showType(*v));
}
if (attr.empty())
if (attr.empty()) {
throw Error(format("empty attribute name in selection path '%1%'") %
attrPath);
}
Bindings::iterator a = v->attrs->find(state.symbols.create(attr));
if (a == v->attrs->end())
if (a == v->attrs->end()) {
throw Error(
format("attribute '%1%' in selection path '%2%' not found") % attr %
attrPath);
}
v = &*a->value;
}
else if (apType == apIndex) {
if (!v->isList())
if (!v->isList()) {
throw TypeError(format("the expression selected by the selection path "
"'%1%' should be a list but is %2%") %
attrPath % showType(*v));
}
if (attrIndex >= v->listSize())
if (attrIndex >= v->listSize()) {
throw Error(
format("list index %1% in selection path '%2%' is out of range") %
attrIndex % attrPath);
}
v = v->listElems()[attrIndex];
}