about summary refs log tree commit diff
path: root/third_party/nix/src/nix-channel
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-05-19T17·55+0100
committerVincent Ambo <tazjin@google.com>2020-05-19T17·55+0100
commit867055133d3f487e52dd44149f76347c2c28bf10 (patch)
treec367803ad94f024b0052727a2c7a037af169169a /third_party/nix/src/nix-channel
parentc6a31838cd7e88ebcb01422b329a499d04ab4b6b (diff)
style(3p/nix): Add braces around single-line conditionals r/771
These were not caught by the previous clang-tidy invocation, but were
instead sorted out using amber[0] as such:

    ambr --regex 'if (\(.+\))\s([a-z].*;)' 'if $1 { $2 }'

[0]: https://github.com/dalance/amber
Diffstat (limited to 'third_party/nix/src/nix-channel')
-rw-r--r--third_party/nix/src/nix-channel/nix-channel.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/third_party/nix/src/nix-channel/nix-channel.cc b/third_party/nix/src/nix-channel/nix-channel.cc
index 767682c0c30d..eca31a53384a 100644
--- a/third_party/nix/src/nix-channel/nix-channel.cc
+++ b/third_party/nix/src/nix-channel/nix-channel.cc
@@ -26,7 +26,9 @@ static void readChannels() {
   for (const auto& line :
        tokenizeString<std::vector<string>>(channelsFile, "\n")) {
     chomp(line);
-    if (std::regex_search(line, std::regex("^\\s*\\#"))) continue;
+    if (std::regex_search(line, std::regex("^\\s*\\#"))) {
+      continue;
+    }
     auto split = tokenizeString<std::vector<string>>(line, " ");
     auto url = std::regex_replace(split[0], std::regex("/*$"), "");
     auto name = split.size() > 1 ? split[1] : baseNameOf(url);
@@ -80,7 +82,9 @@ static void update(const StringSet& channelNames) {
   for (const auto& channel : channels) {
     auto name = channel.first;
     auto url = channel.second;
-    if (!(channelNames.empty() || channelNames.count(name))) continue;
+    if (!(channelNames.empty() || channelNames.count(name))) {
+      continue;
+    }
 
     // We want to download the url to a file to see if it's a tarball while also
     // checking if we got redirected in the process, so that we can grab the
@@ -225,7 +229,9 @@ static int _main(int argc, char** argv) {
         removeChannel(args[0]);
         break;
       case cList:
-        if (!args.empty()) throw UsageError("'--list' expects no arguments");
+        if (!args.empty()) {
+          throw UsageError("'--list' expects no arguments");
+        }
         readChannels();
         for (const auto& channel : channels)
           std::cout << channel.first << ' ' << channel.second << '\n';