From 867055133d3f487e52dd44149f76347c2c28bf10 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 19 May 2020 18:55:58 +0100 Subject: 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 --- third_party/nix/src/libstore/builtins/buildenv.cc | 24 +++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'third_party/nix/src/libstore/builtins/buildenv.cc') diff --git a/third_party/nix/src/libstore/builtins/buildenv.cc b/third_party/nix/src/libstore/builtins/buildenv.cc index fd7d7e979f30..e9a96a8cca15 100644 --- a/third_party/nix/src/libstore/builtins/buildenv.cc +++ b/third_party/nix/src/libstore/builtins/buildenv.cc @@ -99,7 +99,9 @@ static void createLinks(const Path& srcDir, const Path& dstDir, int priority) { "to change the priority of one of the conflicting packages" " (0 being the highest priority)", srcFile, readLink(dstFile), priority); - if (prevPriority < priority) continue; + if (prevPriority < priority) { + continue; + } if (unlink(dstFile.c_str()) == -1) throw SysError(format("unlinking '%1%'") % dstFile); } else if (S_ISDIR(dstSt.st_mode)) @@ -124,7 +126,9 @@ static FileProp postponed = FileProp{}; static Path out; static void addPkg(const Path& pkgDir, int priority) { - if (done.count(pkgDir)) return; + if (done.count(pkgDir)) { + return; + } done.insert(pkgDir); createLinks(pkgDir, out, priority); @@ -132,9 +136,13 @@ static void addPkg(const Path& pkgDir, int priority) { for (const auto& p : tokenizeString>( readFile(pkgDir + "/nix-support/propagated-user-env-packages"), " \n")) - if (!done.count(p)) postponed.insert(p); + if (!done.count(p)) { + postponed.insert(p); + } } catch (SysError& e) { - if (e.errNo != ENOENT && e.errNo != ENOTDIR) throw; + if (e.errNo != ENOENT && e.errNo != ENOTDIR) { + throw; + } } } @@ -151,7 +159,9 @@ typedef std::vector Packages; void builtinBuildenv(const BasicDerivation& drv) { auto getAttr = [&](const string& name) { auto i = drv.env.find(name); - if (i == drv.env.end()) throw Error("attribute '%s' missing", name); + if (i == drv.env.end()) { + throw Error("attribute '%s' missing", name); + } return i->second; }; @@ -187,7 +197,9 @@ void builtinBuildenv(const BasicDerivation& drv) { (a.priority == b.priority && a.path < b.path); }); for (const auto& pkg : pkgs) - if (pkg.active) addPkg(pkg.path, pkg.priority); + if (pkg.active) { + addPkg(pkg.path, pkg.priority); + } /* Symlink to the packages that have been "propagated" by packages * installed by the user (i.e., package X declares that it wants Y -- cgit 1.4.1