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/local-fs-store.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'third_party/nix/src/libstore/local-fs-store.cc') diff --git a/third_party/nix/src/libstore/local-fs-store.cc b/third_party/nix/src/libstore/local-fs-store.cc index f3ac5b3663ff..9a5ea153869a 100644 --- a/third_party/nix/src/libstore/local-fs-store.cc +++ b/third_party/nix/src/libstore/local-fs-store.cc @@ -27,7 +27,7 @@ struct LocalStoreAccessor : public FSAccessor { auto realPath = toRealPath(path); struct stat st; - if (lstat(realPath.c_str(), &st)) { + if (lstat(realPath.c_str(), &st) != 0) { if (errno == ENOENT || errno == ENOTDIR) { return {Type::tMissing, 0, false}; } @@ -42,7 +42,7 @@ struct LocalStoreAccessor : public FSAccessor { ? Type::tRegular : S_ISLNK(st.st_mode) ? Type::tSymlink : Type::tDirectory, S_ISREG(st.st_mode) ? (uint64_t)st.st_size : 0, - S_ISREG(st.st_mode) && st.st_mode & S_IXUSR}; + S_ISREG(st.st_mode) && ((st.st_mode & S_IXUSR) != 0u)}; } StringSet readDirectory(const Path& path) override { @@ -92,7 +92,7 @@ std::shared_ptr LocalFSStore::getBuildLog(const Path& path_) { } catch (InvalidPath&) { return nullptr; } - if (path == "") { + if (path.empty()) { return nullptr; } } @@ -107,8 +107,8 @@ std::shared_ptr LocalFSStore::getBuildLog(const Path& path_) { if (pathExists(logPath)) { return std::make_shared(readFile(logPath)); - - } else if (pathExists(logBz2Path)) { + } + if (pathExists(logBz2Path)) { try { return decompress("bzip2", readFile(logBz2Path)); } catch (Error&) { -- cgit 1.4.1