From 39087321811e81e26a1a47d6967df1088dcf0e95 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 19 May 2020 20:47:23 +0100 Subject: style(3p/nix): Final act in the brace-wrapping saga This last change set was generated by a full clang-tidy run (including compilation): clang-tidy -p ~/projects/nix-build/ \ -checks=-*,readability-braces-around-statements -fix src/*/*.cc Actually running clang-tidy requires some massaging to make it play nice with Nix + meson, I'll be adding a wrapper or something for that soon. --- third_party/nix/src/libstore/local-binary-cache-store.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'third_party/nix/src/libstore/local-binary-cache-store.cc') diff --git a/third_party/nix/src/libstore/local-binary-cache-store.cc b/third_party/nix/src/libstore/local-binary-cache-store.cc index 925fb34de48f..29c74cedd834 100644 --- a/third_party/nix/src/libstore/local-binary-cache-store.cc +++ b/third_party/nix/src/libstore/local-binary-cache-store.cc @@ -26,9 +26,10 @@ class LocalBinaryCacheStore : public BinaryCacheStore { try { readFile(binaryCacheDir + "/" + path, sink); } catch (SysError& e) { - if (e.errNo == ENOENT) + if (e.errNo == ENOENT) { throw NoSuchBinaryCacheFile("file '%s' does not exist in binary cache", path); + } } } @@ -36,8 +37,9 @@ class LocalBinaryCacheStore : public BinaryCacheStore { PathSet paths; for (auto& entry : readDirectory(binaryCacheDir)) { - if (entry.name.size() != 40 || !hasSuffix(entry.name, ".narinfo")) + if (entry.name.size() != 40 || !hasSuffix(entry.name, ".narinfo")) { continue; + } paths.insert(storeDir + "/" + entry.name.substr(0, entry.name.size() - 8)); } @@ -55,8 +57,9 @@ static void atomicWrite(const Path& path, const std::string& s) { Path tmp = path + ".tmp." + std::to_string(getpid()); AutoDelete del(tmp, false); writeFile(tmp, s); - if (rename(tmp.c_str(), path.c_str())) + if (rename(tmp.c_str(), path.c_str())) { throw SysError(format("renaming '%1%' to '%2%'") % tmp % path); + } del.cancel(); } @@ -74,8 +77,9 @@ static RegisterStoreImplementation regStore( [](const std::string& uri, const Store::Params& params) -> std::shared_ptr { if (getEnv("_NIX_FORCE_HTTP_BINARY_CACHE_STORE") == "1" || - std::string(uri, 0, 7) != "file://") + std::string(uri, 0, 7) != "file://") { return 0; + } auto store = std::make_shared(params, std::string(uri, 7)); store->init(); -- cgit 1.4.1