about summary refs log tree commit diff
path: root/third_party/nix/src/libexpr/get-drvs.cc
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-05-19T19·47+0100
committerVincent Ambo <tazjin@google.com>2020-05-19T19·51+0100
commit39087321811e81e26a1a47d6967df1088dcf0e95 (patch)
tree57110be423eeb7869e9960466f4b17c0ea7cd961 /third_party/nix/src/libexpr/get-drvs.cc
parentcf40d08908ede4061eb15513b770c98877844b8b (diff)
style(3p/nix): Final act in the brace-wrapping saga r/777
This last change set was generated by a full clang-tidy run (including
compilation):

    clang-tidy -p ~/projects/nix-build/ \
      -checks=-*,readability-braces-around-statements -fix src/*/*.cc

Actually running clang-tidy requires some massaging to make it play
nice with Nix + meson, I'll be adding a wrapper or something for that soon.
Diffstat (limited to 'third_party/nix/src/libexpr/get-drvs.cc')
-rw-r--r--third_party/nix/src/libexpr/get-drvs.cc26
1 files changed, 16 insertions, 10 deletions
diff --git a/third_party/nix/src/libexpr/get-drvs.cc b/third_party/nix/src/libexpr/get-drvs.cc
index 8897db4be9b1..c62e05d4541c 100644
--- a/third_party/nix/src/libexpr/get-drvs.cc
+++ b/third_party/nix/src/libexpr/get-drvs.cc
@@ -25,18 +25,20 @@ DrvInfo::DrvInfo(EvalState& state, ref<Store> store,
 
   name = storePathToName(drvPath);
 
-  if (spec.second.size() > 1)
+  if (spec.second.size() > 1) {
     throw Error(
         "building more than one derivation output is not supported, in '%s'",
         drvPathWithOutputs);
+  }
 
   outputName = spec.second.empty() ? get(drv.env, "outputName", "out")
                                    : *spec.second.begin();
 
   auto i = drv.outputs.find(outputName);
-  if (i == drv.outputs.end())
+  if (i == drv.outputs.end()) {
     throw Error("derivation '%s' does not have output '%s'", drvPath,
                 outputName);
+  }
 
   outPath = i->second.path;
 }
@@ -110,8 +112,9 @@ DrvInfo::Outputs DrvInfo::queryOutputs(bool onlyOutputsToInstall) {
         outputs[name] =
             state->coerceToPath(*outPath->pos, *outPath->value, context);
       }
-    } else
+    } else {
       outputs["out"] = queryOutPath();
+    }
   }
   if (!onlyOutputsToInstall || !attrs) {
     return outputs;
@@ -363,10 +366,11 @@ static void getDerivations(EvalState& state, Value& vIn,
   state.autoCallFunction(autoArgs, vIn, v);
 
   /* Process the expression. */
-  if (!getDerivation(state, v, pathPrefix, drvs, done, ignoreAssertionFailures))
+  if (!getDerivation(state, v, pathPrefix, drvs, done,
+                     ignoreAssertionFailures)) {
     ;
 
-  else if (v.type == tAttrs) {
+  } else if (v.type == tAttrs) {
     /* !!! undocumented hackery to support combining channels in
        nix-env.cc. */
     bool combineChannels =
@@ -384,11 +388,11 @@ static void getDerivations(EvalState& state, Value& vIn,
         continue;
       }
       string pathPrefix2 = addToPath(pathPrefix, i->name);
-      if (combineChannels)
+      if (combineChannels) {
         getDerivations(state, *i->value, pathPrefix2, autoArgs, drvs, done,
                        ignoreAssertionFailures);
-      else if (getDerivation(state, *i->value, pathPrefix2, drvs, done,
-                             ignoreAssertionFailures)) {
+      } else if (getDerivation(state, *i->value, pathPrefix2, drvs, done,
+                               ignoreAssertionFailures)) {
         /* If the value of this attribute is itself a set,
            should we recurse into it?  => Only if it has a
            `recurseForDerivations = true' attribute. */
@@ -396,9 +400,10 @@ static void getDerivations(EvalState& state, Value& vIn,
           Bindings::iterator j = i->value->attrs->find(
               state.symbols.create("recurseForDerivations"));
           if (j != i->value->attrs->end() &&
-              state.forceBool(*j->value, *j->pos))
+              state.forceBool(*j->value, *j->pos)) {
             getDerivations(state, *i->value, pathPrefix2, autoArgs, drvs, done,
                            ignoreAssertionFailures);
+          }
         }
       }
     }
@@ -408,9 +413,10 @@ static void getDerivations(EvalState& state, Value& vIn,
     for (unsigned int n = 0; n < v.listSize(); ++n) {
       string pathPrefix2 = addToPath(pathPrefix, (format("%1%") % n).str());
       if (getDerivation(state, *v.listElems()[n], pathPrefix2, drvs, done,
-                        ignoreAssertionFailures))
+                        ignoreAssertionFailures)) {
         getDerivations(state, *v.listElems()[n], pathPrefix2, autoArgs, drvs,
                        done, ignoreAssertionFailures);
+      }
     }
   }