Add braces to C++ single-line loops and conditionals (NFC) (#2973)

This makes code easier to read and more consistent between C++ and Java.
Also update clang-format settings to always add a line break (even if no braces are used).
This commit is contained in:
Peter Johnson
2020-12-28 12:58:06 -08:00
committed by GitHub
parent 0291a3ff56
commit 2aed432b4b
634 changed files with 10716 additions and 3938 deletions

View File

@@ -23,10 +23,11 @@ void GetAddrInfo(Loop& loop, const std::shared_ptr<GetAddrInfoReq>& req,
loop.GetRaw(), req->GetRaw(),
[](uv_getaddrinfo_t* req, int status, addrinfo* res) {
auto& h = *static_cast<GetAddrInfoReq*>(req->data);
if (status < 0)
if (status < 0) {
h.ReportError(status);
else
} else {
h.resolved(*res);
}
uv_freeaddrinfo(res);
h.Release(); // this is always a one-shot
},
@@ -34,10 +35,11 @@ void GetAddrInfo(Loop& loop, const std::shared_ptr<GetAddrInfoReq>& req,
service.isNull() ? nullptr
: service.toNullTerminatedStringRef(serviceStr).data(),
hints);
if (err < 0)
if (err < 0) {
loop.ReportError(err);
else
} else {
req->Keep();
}
}
void GetAddrInfo(Loop& loop, std::function<void(const addrinfo&)> callback,