diff options
author | Vincent Ambo <tazjin@google.com> | 2020-05-19T19·47+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-05-19T19·51+0100 |
commit | 39087321811e81e26a1a47d6967df1088dcf0e95 (patch) | |
tree | 57110be423eeb7869e9960466f4b17c0ea7cd961 /third_party/nix/src/nix/hash.cc | |
parent | cf40d08908ede4061eb15513b770c98877844b8b (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/nix/hash.cc')
-rw-r--r-- | third_party/nix/src/nix/hash.cc | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/third_party/nix/src/nix/hash.cc b/third_party/nix/src/nix/hash.cc index 77be77cfcdc0..39780532f842 100644 --- a/third_party/nix/src/nix/hash.cc +++ b/third_party/nix/src/nix/hash.cc @@ -73,8 +73,9 @@ struct CmdToBase : Command { } void run() override { - for (auto s : args) + for (auto s : args) { std::cout << fmt("%s\n", Hash(s, ht).to_string(base, base == SRI)); + } } }; @@ -94,29 +95,31 @@ static int compatNixHash(int argc, char** argv) { parseCmdLine(argc, argv, [&](Strings::iterator& arg, const Strings::iterator& end) { - if (*arg == "--help") + if (*arg == "--help") { showManPage("nix-hash"); - else if (*arg == "--version") + } else if (*arg == "--version") { printVersion("nix-hash"); - else if (*arg == "--flat") + } else if (*arg == "--flat") { flat = true; - else if (*arg == "--base32") + } else if (*arg == "--base32") { base32 = true; - else if (*arg == "--truncate") + } else if (*arg == "--truncate") { truncate = true; - else if (*arg == "--type") { + } else if (*arg == "--type") { string s = getArg(*arg, arg, end); ht = parseHashType(s); - if (ht == htUnknown) + if (ht == htUnknown) { throw UsageError(format("unknown hash type '%1%'") % s); - } else if (*arg == "--to-base16") + } + } else if (*arg == "--to-base16") { op = opTo16; - else if (*arg == "--to-base32") + } else if (*arg == "--to-base32") { op = opTo32; - else if (*arg != "" && arg->at(0) == '-') + } else if (*arg != "" && arg->at(0) == '-') { return false; - else + } else { ss.push_back(*arg); + } return true; }); |