about summary refs log tree commit diff
path: root/third_party/nix/src/libexpr/value-to-xml.cc
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-05-19T17·01+0100
committerVincent Ambo <tazjin@google.com>2020-05-19T17·01+0100
commit09cbc431cca08be891e5e792ceda2a34956b2fc8 (patch)
tree3653448c7e074bdfd10dfa3bc3b5dfe952299fdf /third_party/nix/src/libexpr/value-to-xml.cc
parentb490742a511dd03afc43f5143d6d61edaeeb8091 (diff)
fix(3p/nix): Fix incorrectly braced conditionals and loops r/768
Fixes mistakes introduced by clang-tidy in the previous commit.
Diffstat (limited to 'third_party/nix/src/libexpr/value-to-xml.cc')
-rw-r--r--third_party/nix/src/libexpr/value-to-xml.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/third_party/nix/src/libexpr/value-to-xml.cc b/third_party/nix/src/libexpr/value-to-xml.cc
index 5ea1e09824c7..6247d25b9c34 100644
--- a/third_party/nix/src/libexpr/value-to-xml.cc
+++ b/third_party/nix/src/libexpr/value-to-xml.cc
@@ -137,15 +137,20 @@ static void printValueAsXML(EvalState& state, bool strict, bool location,
 
       if (v.lambda.fun->matchAttrs) {
         XMLAttrs attrs;
-        if (!v.lambda.fun->arg.empty()) attrs["name"] = v.lambda.fun->arg;
-        if (v.lambda.fun->formals->ellipsis) attrs["ellipsis"] = "1";
+        if (!v.lambda.fun->arg.empty()) {
+          attrs["name"] = v.lambda.fun->arg;
+        }
+        if (v.lambda.fun->formals->ellipsis) {
+          attrs["ellipsis"] = "1";
+        }
         XMLOpenElement _(doc, "attrspat", attrs);
-        for (auto& i : v.lambda.fun->formals->formals)
+        for (auto& i : v.lambda.fun->formals->formals) {
           doc.writeEmptyElement("attr", singletonAttrs("name", i.name));
+        }
       } else {
-        doc
+        doc.writeEmptyElement("varpat",
+                              singletonAttrs("name", v.lambda.fun->arg));
       }
-      .writeEmptyElement("varpat", singletonAttrs("name", v.lambda.fun->arg));
 
       break;
     }