From 867055133d3f487e52dd44149f76347c2c28bf10 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 19 May 2020 18:55:58 +0100 Subject: style(3p/nix): Add braces around single-line conditionals 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 --- third_party/nix/src/libstore/nar-accessor.cc | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'third_party/nix/src/libstore/nar-accessor.cc') diff --git a/third_party/nix/src/libstore/nar-accessor.cc b/third_party/nix/src/libstore/nar-accessor.cc index b36f75401bd3..0214561da456 100644 --- a/third_party/nix/src/libstore/nar-accessor.cc +++ b/third_party/nix/src/libstore/nar-accessor.cc @@ -133,7 +133,9 @@ struct NarAccessor : public FSAccessor { for (auto it = path.begin(); it != end;) { // because it != end, the remaining component is non-empty so we need // a directory - if (current->type != FSAccessor::Type::tDirectory) return nullptr; + if (current->type != FSAccessor::Type::tDirectory) { + return nullptr; + } // skip slash (canonPath above ensures that this is always a slash) assert(*it == '/'); @@ -142,7 +144,9 @@ struct NarAccessor : public FSAccessor { // lookup current component auto next = std::find(it, end, '/'); auto child = current->children.find(std::string(it, next)); - if (child == current->children.end()) return nullptr; + if (child == current->children.end()) { + return nullptr; + } current = &child->second; it = next; @@ -160,7 +164,9 @@ struct NarAccessor : public FSAccessor { Stat stat(const Path& path) override { auto i = find(path); - if (i == nullptr) return {FSAccessor::Type::tMissing, 0, false}; + if (i == nullptr) { + return {FSAccessor::Type::tMissing, 0, false}; + } return {i->type, i->size, i->isExecutable, i->start}; } @@ -183,7 +189,9 @@ struct NarAccessor : public FSAccessor { throw Error(format("path '%1%' inside NAR file is not a regular file") % path); - if (getNarBytes) return getNarBytes(i.start, i.size); + if (getNarBytes) { + return getNarBytes(i.start, i.size); + } assert(nar); return std::string(*nar, i.start, i.size); @@ -216,8 +224,12 @@ void listNar(JSONPlaceholder& res, ref accessor, const Path& path, case FSAccessor::Type::tRegular: obj.attr("type", "regular"); obj.attr("size", st.fileSize); - if (st.isExecutable) obj.attr("executable", true); - if (st.narOffset) obj.attr("narOffset", st.narOffset); + if (st.isExecutable) { + obj.attr("executable", true); + } + if (st.narOffset) { + obj.attr("narOffset", st.narOffset); + } break; case FSAccessor::Type::tDirectory: obj.attr("type", "directory"); -- cgit 1.4.1