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/local-fs-store.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/local-fs-store.cc')
-rw-r--r-- | third_party/nix/src/libstore/local-fs-store.cc | 10 |
1 files changed, 5 insertions, 5 deletions
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<std::string> LocalFSStore::getBuildLog(const Path& path_) { } catch (InvalidPath&) { return nullptr; } - if (path == "") { + if (path.empty()) { return nullptr; } } @@ -107,8 +107,8 @@ std::shared_ptr<std::string> LocalFSStore::getBuildLog(const Path& path_) { if (pathExists(logPath)) { return std::make_shared<std::string>(readFile(logPath)); - - } else if (pathExists(logBz2Path)) { + } + if (pathExists(logBz2Path)) { try { return decompress("bzip2", readFile(logBz2Path)); } catch (Error&) { |