about summary refs log tree commit diff
path: root/third_party/nix/src/libstore/references.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/references.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/references.cc')
-rw-r--r--third_party/nix/src/libstore/references.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/third_party/nix/src/libstore/references.cc b/third_party/nix/src/libstore/references.cc
index 63cd284732..a46bdc758f 100644
--- a/third_party/nix/src/libstore/references.cc
+++ b/third_party/nix/src/libstore/references.cc
@@ -35,7 +35,9 @@ static void search(const unsigned char* s, size_t len, StringSet& hashes,
         match = false;
         break;
       }
-    if (!match) continue;
+    if (!match) {
+      continue;
+    }
     string ref((const char*)s + i, refLength);
     if (hashes.find(ref) != hashes.end()) {
       DLOG(INFO) << "found reference to '" << ref << "' at offset " << i;
@@ -88,7 +90,9 @@ PathSet scanForReferences(const string& path, const PathSet& refs,
   for (auto& i : refs) {
     string baseName = baseNameOf(i);
     string::size_type pos = baseName.find('-');
-    if (pos == string::npos) throw Error(format("bad reference '%1%'") % i);
+    if (pos == string::npos) {
+      throw Error(format("bad reference '%1%'") % i);
+    }
     string s = string(baseName, 0, pos);
     assert(s.size() == refLength);
     assert(backMap.find(s) == backMap.end());
@@ -104,7 +108,9 @@ PathSet scanForReferences(const string& path, const PathSet& refs,
   PathSet found;
   for (auto& i : sink.seen) {
     std::map<string, Path>::iterator j;
-    if ((j = backMap.find(i)) == backMap.end()) abort();
+    if ((j = backMap.find(i)) == backMap.end()) {
+      abort();
+    }
     found.insert(j->second);
   }