about summary refs log tree commit diff
path: root/third_party/nix/src/libstore/s3-binary-cache-store.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/s3-binary-cache-store.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/s3-binary-cache-store.cc')
-rw-r--r--third_party/nix/src/libstore/s3-binary-cache-store.cc16
1 files changed, 12 insertions, 4 deletions
diff --git a/third_party/nix/src/libstore/s3-binary-cache-store.cc b/third_party/nix/src/libstore/s3-binary-cache-store.cc
index 1249a92d3f58..483ddc19a3aa 100644
--- a/third_party/nix/src/libstore/s3-binary-cache-store.cc
+++ b/third_party/nix/src/libstore/s3-binary-cache-store.cc
@@ -153,7 +153,9 @@ S3Helper::DownloadResult S3Helper::getObject(const std::string& bucketName,
                    dynamic_cast<std::stringstream&>(result.GetBody()).str());
 
   } catch (S3Error& e) {
-    if (e.err != Aws::S3::S3Errors::NO_SUCH_KEY) throw;
+    if (e.err != Aws::S3::S3Errors::NO_SUCH_KEY) {
+      throw;
+    }
   }
 
   auto now2 = std::chrono::steady_clock::now();
@@ -315,7 +317,9 @@ struct S3BinaryCacheStoreImpl : public S3BinaryCacheStore {
 
       request.SetContentType(mimeType);
 
-      if (contentEncoding != "") request.SetContentEncoding(contentEncoding);
+      if (contentEncoding != "") {
+        request.SetContentEncoding(contentEncoding);
+      }
 
       auto stream = std::make_shared<istringstream_nocopy>(data);
 
@@ -394,7 +398,9 @@ struct S3BinaryCacheStoreImpl : public S3BinaryCacheStore {
 
       for (auto object : contents) {
         auto& key = object.GetKey();
-        if (key.size() != 40 || !hasSuffix(key, ".narinfo")) continue;
+        if (key.size() != 40 || !hasSuffix(key, ".narinfo")) {
+          continue;
+        }
         paths.insert(storeDir + "/" + key.substr(0, key.size() - 8));
       }
 
@@ -408,7 +414,9 @@ struct S3BinaryCacheStoreImpl : public S3BinaryCacheStore {
 static RegisterStoreImplementation regStore(
     [](const std::string& uri,
        const Store::Params& params) -> std::shared_ptr<Store> {
-      if (std::string(uri, 0, 5) != "s3://") return 0;
+      if (std::string(uri, 0, 5) != "s3://") {
+        return 0;
+      }
       auto store =
           std::make_shared<S3BinaryCacheStoreImpl>(params, std::string(uri, 5));
       store->init();