about summary refs log tree commit diff
path: root/third_party/nix/src/libstore/nar-info-disk-cache.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/nar-info-disk-cache.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/nar-info-disk-cache.cc')
-rw-r--r--third_party/nix/src/libstore/nar-info-disk-cache.cc20
1 files changed, 15 insertions, 5 deletions
diff --git a/third_party/nix/src/libstore/nar-info-disk-cache.cc b/third_party/nix/src/libstore/nar-info-disk-cache.cc
index 6d40f4abc6..6d9aeb129d 100644
--- a/third_party/nix/src/libstore/nar-info-disk-cache.cc
+++ b/third_party/nix/src/libstore/nar-info-disk-cache.cc
@@ -143,7 +143,9 @@ class NarInfoDiskCacheImpl : public NarInfoDiskCache {
 
   Cache& getCache(State& state, const std::string& uri) {
     auto i = state.caches.find(uri);
-    if (i == state.caches.end()) abort();
+    if (i == state.caches.end()) {
+      abort();
+    }
     return i->second;
   }
 
@@ -170,7 +172,9 @@ class NarInfoDiskCacheImpl : public NarInfoDiskCache {
       auto i = state->caches.find(uri);
       if (i == state->caches.end()) {
         auto queryCache(state->queryCache.use()(uri));
-        if (!queryCache.next()) return false;
+        if (!queryCache.next()) {
+          return false;
+        }
         state->caches.emplace(
             uri, Cache{(int)queryCache.getInt(0), queryCache.getStr(1),
                        queryCache.getInt(2) != 0, (int)queryCache.getInt(3)});
@@ -199,9 +203,13 @@ class NarInfoDiskCacheImpl : public NarInfoDiskCache {
               now - settings.ttlNegativeNarInfoCache)(
               now - settings.ttlPositiveNarInfoCache));
 
-          if (!queryNAR.next()) return {oUnknown, 0};
+          if (!queryNAR.next()) {
+            return {oUnknown, 0};
+          }
 
-          if (!queryNAR.getInt(0)) return {oInvalid, 0};
+          if (!queryNAR.getInt(0)) {
+            return {oInvalid, 0};
+          }
 
           auto narInfo = make_ref<NarInfo>();
 
@@ -210,7 +218,9 @@ class NarInfoDiskCacheImpl : public NarInfoDiskCache {
                           (namePart.empty() ? "" : "-" + namePart);
           narInfo->url = queryNAR.getStr(2);
           narInfo->compression = queryNAR.getStr(3);
-          if (!queryNAR.isNull(4)) narInfo->fileHash = Hash(queryNAR.getStr(4));
+          if (!queryNAR.isNull(4)) {
+            narInfo->fileHash = Hash(queryNAR.getStr(4));
+          }
           narInfo->fileSize = queryNAR.getInt(5);
           narInfo->narHash = Hash(queryNAR.getStr(6));
           narInfo->narSize = queryNAR.getInt(7);