style(3p/nix): Enforce braces around loops and conditionals
This change was generated with:
fd -e cc -e hh | xargs -I{} clang-tidy {} -p ~/projects/nix-build/ \
--checks='-*,readability-braces-around-statements' --fix \
-fix-errors
Some manual fixes were applied because some convoluted unbraced
statements couldn't be untangled by clang-tidy.
This commit still includes invalid files, but I decided to clean them
up in a subsequent commit so that it becomes more obvious where
clang-tidy failed. Maybe this will allow for a bug-report to
clang-tidy.
This commit is contained in:
parent
c758de9d22
commit
b490742a51
44 changed files with 661 additions and 298 deletions
12
third_party/nix/src/libstore/gc.cc
vendored
12
third_party/nix/src/libstore/gc.cc
vendored
|
|
@ -630,7 +630,9 @@ void LocalStore::tryToDelete(GCState& state, const Path& path) {
|
|||
‘nix-store --delete’ doesn't have the unexpected effect of
|
||||
recursing into derivations and outputs. */
|
||||
state.dead.insert(visited.begin(), visited.end());
|
||||
if (state.shouldDelete) deletePathRecursive(state, path);
|
||||
if (state.shouldDelete) {
|
||||
deletePathRecursive(state, path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -704,7 +706,9 @@ void LocalStore::collectGarbage(const GCOptions& options, GCResults& results) {
|
|||
state.shouldDelete = options.action == GCOptions::gcDeleteDead ||
|
||||
options.action == GCOptions::gcDeleteSpecific;
|
||||
|
||||
if (state.shouldDelete) deletePath(reservedPath);
|
||||
if (state.shouldDelete) {
|
||||
deletePath(reservedPath);
|
||||
}
|
||||
|
||||
/* Acquire the global GC root. This prevents
|
||||
a) New roots from being added.
|
||||
|
|
@ -737,7 +741,9 @@ void LocalStore::collectGarbage(const GCOptions& options, GCResults& results) {
|
|||
that is not reachable from `roots' is garbage. */
|
||||
|
||||
if (state.shouldDelete) {
|
||||
if (pathExists(trashDir)) deleteGarbage(state, trashDir);
|
||||
if (pathExists(trashDir)) {
|
||||
deleteGarbage(state, trashDir);
|
||||
}
|
||||
try {
|
||||
createDirs(trashDir);
|
||||
} catch (SysError& e) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue