From 689ef502f5b0655c9923ed77da2ae3504630f473 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 20 May 2020 22:27:37 +0100 Subject: refactor(3p/nix): Apply clang-tidy's readability-* fixes This applies the readability fixes listed here: https://clang.llvm.org/extra/clang-tidy/checks/list.html --- third_party/nix/src/libstore/remote-fs-accessor.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'third_party/nix/src/libstore/remote-fs-accessor.cc') 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, 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 narAccessor) { nars.emplace(storePath, narAccessor); - if (cacheDir != "") { + if (!cacheDir.empty()) { try { std::ostringstream str; JSONPlaceholder jsonRoot(str); @@ -62,7 +62,7 @@ std::pair, 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")); -- cgit 1.4.1