about summary refs log tree commit diff
path: root/third_party/nix/src/libstore/remote-fs-accessor.cc
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-05-19T17·55+0100
committerVincent Ambo <tazjin@google.com>2020-05-19T17·55+0100
commit867055133d3f487e52dd44149f76347c2c28bf10 (patch)
treec367803ad94f024b0052727a2c7a037af169169a /third_party/nix/src/libstore/remote-fs-accessor.cc
parentc6a31838cd7e88ebcb01422b329a499d04ab4b6b (diff)
style(3p/nix): Add braces around single-line conditionals r/771
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
Diffstat (limited to 'third_party/nix/src/libstore/remote-fs-accessor.cc')
-rw-r--r--third_party/nix/src/libstore/remote-fs-accessor.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/third_party/nix/src/libstore/remote-fs-accessor.cc b/third_party/nix/src/libstore/remote-fs-accessor.cc
index 63a0f58fda51..0b9bb805ebce 100644
--- a/third_party/nix/src/libstore/remote-fs-accessor.cc
+++ b/third_party/nix/src/libstore/remote-fs-accessor.cc
@@ -11,7 +11,9 @@ namespace nix {
 
 RemoteFSAccessor::RemoteFSAccessor(ref<Store> store, const Path& cacheDir)
     : store(store), cacheDir(cacheDir) {
-  if (cacheDir != "") createDirs(cacheDir);
+  if (cacheDir != "") {
+    createDirs(cacheDir);
+  }
 }
 
 Path RemoteFSAccessor::makeCacheFile(const Path& storePath,
@@ -51,7 +53,9 @@ std::pair<ref<FSAccessor>, Path> RemoteFSAccessor::fetch(const Path& path_) {
                       storePath);
 
   auto i = nars.find(storePath);
-  if (i != nars.end()) return {i->second, restPath};
+  if (i != nars.end()) {
+    return {i->second, restPath};
+  }
 
   StringSink sink;
   std::string listing;
@@ -65,7 +69,9 @@ std::pair<ref<FSAccessor>, Path> RemoteFSAccessor::fetch(const Path& path_) {
       auto narAccessor = makeLazyNarAccessor(
           listing, [cacheFile](uint64_t offset, uint64_t length) {
             AutoCloseFD fd = open(cacheFile.c_str(), O_RDONLY | O_CLOEXEC);
-            if (!fd) throw SysError("opening NAR cache file '%s'", cacheFile);
+            if (!fd) {
+              throw SysError("opening NAR cache file '%s'", cacheFile);
+            }
 
             if (lseek(fd.get(), offset, SEEK_SET) != (off_t)offset)
               throw SysError("seeking in '%s'", cacheFile);