mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-01 02:41:48 +00:00
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:
@@ -40,10 +40,11 @@ class Async final : public HandleImpl<Async<T...>, uv_async_t> {
|
||||
Async(const std::shared_ptr<Loop>& loop, const private_init&)
|
||||
: m_loop{loop} {}
|
||||
~Async() noexcept override {
|
||||
if (auto loop = m_loop.lock())
|
||||
if (auto loop = m_loop.lock()) {
|
||||
this->Close();
|
||||
else
|
||||
} else {
|
||||
this->ForceClosed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,7 +67,9 @@ class Async final : public HandleImpl<Async<T...>, uv_async_t> {
|
||||
uv_async_init(loop->GetRaw(), h->GetRaw(), [](uv_async_t* handle) {
|
||||
auto& h = *static_cast<Async*>(handle->data);
|
||||
std::scoped_lock lock(h.m_mutex);
|
||||
for (auto&& v : h.m_data) std::apply(h.wakeup, v);
|
||||
for (auto&& v : h.m_data) {
|
||||
std::apply(h.wakeup, v);
|
||||
}
|
||||
h.m_data.clear();
|
||||
});
|
||||
if (err < 0) {
|
||||
@@ -96,7 +99,9 @@ class Async final : public HandleImpl<Async<T...>, uv_async_t> {
|
||||
std::scoped_lock lock(m_mutex);
|
||||
m_data.emplace_back(std::forward_as_tuple(std::forward<U>(u)...));
|
||||
}
|
||||
if (loop) this->Invoke(&uv_async_send, this->GetRaw());
|
||||
if (loop) {
|
||||
this->Invoke(&uv_async_send, this->GetRaw());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -146,7 +151,9 @@ class Async<> final : public HandleImpl<Async<>, uv_async_t> {
|
||||
* An async event will be emitted on the loop thread.
|
||||
*/
|
||||
void Send() {
|
||||
if (auto loop = m_loop.lock()) Invoke(&uv_async_send, GetRaw());
|
||||
if (auto loop = m_loop.lock()) {
|
||||
Invoke(&uv_async_send, GetRaw());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user