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.
This commit is contained in:
Vincent Ambo 2020-05-19 20:47:23 +01:00
parent cf40d08908
commit 3908732181
84 changed files with 2601 additions and 1554 deletions

View file

@ -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<Store> {
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<LocalBinaryCacheStore>(params, std::string(uri, 7));
store->init();