diff options
author | Vincent Ambo <tazjin@google.com> | 2020-05-20T21·27+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-05-20T21·27+0100 |
commit | 689ef502f5b0655c9923ed77da2ae3504630f473 (patch) | |
tree | 3e331c153646f136875f047cc3b9f0aad8c86341 /third_party/nix/src/libstore/remote-fs-accessor.cc | |
parent | d331d3a0b5c497a46e2636f308234be66566c04c (diff) |
refactor(3p/nix): Apply clang-tidy's readability-* fixes r/788
This applies the readability fixes listed here: https://clang.llvm.org/extra/clang-tidy/checks/list.html
Diffstat (limited to 'third_party/nix/src/libstore/remote-fs-accessor.cc')
-rw-r--r-- | third_party/nix/src/libstore/remote-fs-accessor.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/third_party/nix/src/libstore/remote-fs-accessor.cc b/third_party/nix/src/libstore/remote-fs-accessor.cc index 819f54c161e8..9aceaa9815b5 100644 --- a/third_party/nix/src/libstore/remote-fs-accessor.cc +++ b/third_party/nix/src/libstore/remote-fs-accessor.cc @@ -11,14 +11,14 @@ namespace nix { RemoteFSAccessor::RemoteFSAccessor(ref<Store> store, const Path& cacheDir) : store(store), cacheDir(cacheDir) { - if (cacheDir != "") { + if (!cacheDir.empty()) { createDirs(cacheDir); } } Path RemoteFSAccessor::makeCacheFile(const Path& storePath, const std::string& ext) { - assert(cacheDir != ""); + assert(!cacheDir.empty()); return fmt("%s/%s.%s", cacheDir, storePathToHash(storePath), ext); } @@ -26,7 +26,7 @@ void RemoteFSAccessor::addToCache(const Path& storePath, const std::string& nar, ref<FSAccessor> narAccessor) { nars.emplace(storePath, narAccessor); - if (cacheDir != "") { + if (!cacheDir.empty()) { try { std::ostringstream str; JSONPlaceholder jsonRoot(str); @@ -62,7 +62,7 @@ std::pair<ref<FSAccessor>, Path> RemoteFSAccessor::fetch(const Path& path_) { std::string listing; Path cacheFile; - if (cacheDir != "" && + if (!cacheDir.empty() && pathExists(cacheFile = makeCacheFile(storePath, "nar"))) { try { listing = nix::readFile(makeCacheFile(storePath, "ls")); |