about summary refs log tree commit diff
path: root/third_party/nix/src/nix/main.cc
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/main.cc
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/main.cc')
-rw-r--r--third_party/nix/src/nix/main.cc24
1 files changed, 18 insertions, 6 deletions
diff --git a/third_party/nix/src/nix/main.cc b/third_party/nix/src/nix/main.cc
index 6e4db63cce0a..9dbe9b155bf2 100644
--- a/third_party/nix/src/nix/main.cc
+++ b/third_party/nix/src/nix/main.cc
@@ -27,12 +27,16 @@ namespace nix {
 static bool haveInternet() {
   struct ifaddrs* addrs;
 
-  if (getifaddrs(&addrs)) return true;
+  if (getifaddrs(&addrs)) {
+    return true;
+  }
 
   Finally free([&]() { freeifaddrs(addrs); });
 
   for (auto i = addrs; i; i = i->ifa_next) {
-    if (!i->ifa_addr) continue;
+    if (!i->ifa_addr) {
+      continue;
+    }
     if (i->ifa_addr->sa_family == AF_INET) {
       if (ntohl(((sockaddr_in*)i->ifa_addr)->sin_addr.s_addr) !=
           INADDR_LOOPBACK) {
@@ -127,7 +131,9 @@ void mainWrapped(int argc, char** argv) {
 
   {
     auto legacy = (*RegisterLegacyCommand::commands)[programName];
-    if (legacy) return legacy(argc, argv);
+    if (legacy) {
+      return legacy(argc, argv);
+    }
   }
 
   settings.verboseBuild = false;
@@ -138,7 +144,9 @@ void mainWrapped(int argc, char** argv) {
 
   initPlugins();
 
-  if (!args.command) args.showHelpAndExit();
+  if (!args.command) {
+    args.showHelpAndExit();
+  }
 
   if (args.useNet && !haveInternet()) {
     LOG(WARNING) << "you don't have Internet access; "
@@ -148,10 +156,14 @@ void mainWrapped(int argc, char** argv) {
 
   if (!args.useNet) {
     // FIXME: should check for command line overrides only.
-    if (!settings.useSubstitutes.overriden) settings.useSubstitutes = false;
+    if (!settings.useSubstitutes.overriden) {
+      settings.useSubstitutes = false;
+    }
     if (!settings.tarballTtl.overriden)
       settings.tarballTtl = std::numeric_limits<unsigned int>::max();
-    if (!downloadSettings.tries.overriden) downloadSettings.tries = 0;
+    if (!downloadSettings.tries.overriden) {
+      downloadSettings.tries = 0;
+    }
     if (!downloadSettings.connectTimeout.overriden)
       downloadSettings.connectTimeout = 1;
   }