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

@ -40,15 +40,16 @@ void processExpr(EvalState& state, const Strings& attrPaths, bool parseOnly,
PathSet context;
if (evalOnly) {
Value vRes;
if (autoArgs.empty())
if (autoArgs.empty()) {
vRes = v;
else
} else {
state.autoCallFunction(autoArgs, v, vRes);
if (output == okXML)
}
if (output == okXML) {
printValueAsXML(state, strict, location, vRes, std::cout, context);
else if (output == okJSON)
} else if (output == okJSON) {
printValueAsJSON(state, strict, vRes, std::cout, context);
else {
} else {
if (strict) {
state.forceValueDeep(vRes);
}
@ -62,21 +63,23 @@ void processExpr(EvalState& state, const Strings& attrPaths, bool parseOnly,
/* What output do we want? */
string outputName = i.queryOutputName();
if (outputName == "")
if (outputName == "") {
throw Error(
format("derivation '%1%' lacks an 'outputName' attribute ") %
drvPath);
}
if (gcRoot == "")
if (gcRoot == "") {
printGCWarning();
else {
} else {
Path rootName = indirectRoot ? absPath(gcRoot) : gcRoot;
if (++rootNr > 1) {
rootName += "-" + std::to_string(rootNr);
}
auto store2 = state.store.dynamic_pointer_cast<LocalFSStore>();
if (store2)
if (store2) {
drvPath = store2->addPermRoot(drvPath, rootName, indirectRoot);
}
}
std::cout << format("%1%%2%\n") % drvPath %
(outputName != "out" ? "!" + outputName : "");
@ -106,44 +109,45 @@ static int _main(int argc, char** argv) {
MyArgs myArgs(baseNameOf(argv[0]),
[&](Strings::iterator& arg, const Strings::iterator& end) {
if (*arg == "--help")
if (*arg == "--help") {
showManPage("nix-instantiate");
else if (*arg == "--version")
} else if (*arg == "--version") {
printVersion("nix-instantiate");
else if (*arg == "-")
} else if (*arg == "-") {
readStdin = true;
else if (*arg == "--expr" || *arg == "-E")
} else if (*arg == "--expr" || *arg == "-E") {
fromArgs = true;
else if (*arg == "--eval" || *arg == "--eval-only")
} else if (*arg == "--eval" || *arg == "--eval-only") {
evalOnly = true;
else if (*arg == "--read-write-mode")
} else if (*arg == "--read-write-mode") {
wantsReadWrite = true;
else if (*arg == "--parse" || *arg == "--parse-only")
} else if (*arg == "--parse" || *arg == "--parse-only") {
parseOnly = evalOnly = true;
else if (*arg == "--find-file")
} else if (*arg == "--find-file") {
findFile = true;
else if (*arg == "--attr" || *arg == "-A")
} else if (*arg == "--attr" || *arg == "-A") {
attrPaths.push_back(getArg(*arg, arg, end));
else if (*arg == "--add-root")
} else if (*arg == "--add-root") {
gcRoot = getArg(*arg, arg, end);
else if (*arg == "--indirect")
} else if (*arg == "--indirect") {
indirectRoot = true;
else if (*arg == "--xml")
} else if (*arg == "--xml") {
outputKind = okXML;
else if (*arg == "--json")
} else if (*arg == "--json") {
outputKind = okJSON;
else if (*arg == "--no-location")
} else if (*arg == "--no-location") {
xmlOutputSourceLocation = false;
else if (*arg == "--strict")
} else if (*arg == "--strict") {
strict = true;
else if (*arg == "--repair")
} else if (*arg == "--repair") {
repair = Repair;
else if (*arg == "--dry-run")
} else if (*arg == "--dry-run") {
settings.readOnlyMode = true;
else if (*arg != "" && arg->at(0) == '-')
} else if (*arg != "" && arg->at(0) == '-') {
return false;
else
} else {
files.push_back(*arg);
}
return true;
});