about summary refs log tree commit diff
path: root/third_party/nix/src/libstore/globals.cc
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-05-20T21·27+0100
committerVincent Ambo <tazjin@google.com>2020-05-20T21·27+0100
commit689ef502f5b0655c9923ed77da2ae3504630f473 (patch)
tree3e331c153646f136875f047cc3b9f0aad8c86341 /third_party/nix/src/libstore/globals.cc
parentd331d3a0b5c497a46e2636f308234be66566c04c (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/globals.cc')
-rw-r--r--third_party/nix/src/libstore/globals.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/third_party/nix/src/libstore/globals.cc b/third_party/nix/src/libstore/globals.cc
index ade200f135..57ba8cff64 100644
--- a/third_party/nix/src/libstore/globals.cc
+++ b/third_party/nix/src/libstore/globals.cc
@@ -46,7 +46,7 @@ Settings::Settings()
   lockCPU = getEnv("NIX_AFFINITY_HACK", "1") == "1";
 
   caFile = getEnv("NIX_SSL_CERT_FILE", getEnv("SSL_CERT_FILE", ""));
-  if (caFile == "") {
+  if (caFile.empty()) {
     for (auto& fn :
          {"/etc/ssl/certs/ca-certificates.crt",
           "/nix/var/nix/profiles/default/etc/ssl/certs/ca-bundle.crt"}) {
@@ -59,7 +59,7 @@ Settings::Settings()
 
   /* Backwards compatibility. */
   auto s = getEnv("NIX_REMOTE_SYSTEMS");
-  if (s != "") {
+  if (!s.empty()) {
     Strings ss;
     for (auto& p : tokenizeString<Strings>(s, ":")) {
       ss.push_back("@" + p);
@@ -128,7 +128,8 @@ template <>
 std::string BaseSetting<SandboxMode>::to_string() {
   if (value == smEnabled) {
     return "true";
-  } else if (value == smRelaxed) {
+  }
+  if (value == smRelaxed) {
     return "relaxed";
   } else if (value == smDisabled) {
     return "false";
@@ -189,7 +190,7 @@ void initPlugins() {
       /* handle is purposefully leaked as there may be state in the
          DSO needed by the action of the plugin. */
       void* handle = dlopen(file.c_str(), RTLD_LAZY | RTLD_LOCAL);
-      if (!handle) {
+      if (handle == nullptr) {
         throw Error("could not dynamically open plugin file '%s': %s", file,
                     dlerror());
       }