style: add braces around single-statement bodies

- wrap single-statement control-flow bodies in braces
- clang-tidy readability-braces-around-statements
  https://clang.llvm.org/extra/clang-tidy/checks/readability/braces-around-statements.html
This commit is contained in:
Dennis Klein
2026-06-09 19:58:45 +02:00
committed by Dennis Klein
parent e23c4d8ff1
commit 7a44c5e19e
2 changed files with 9 additions and 3 deletions

View File

@@ -17,7 +17,9 @@ auto PluginServices::ChangeDeviceState(const string& controller, const DeviceSta
{ {
lock_guard<mutex> lock{fDeviceControllerMutex}; lock_guard<mutex> lock{fDeviceControllerMutex};
if (!fDeviceController) fDeviceController = controller; if (!fDeviceController) {
fDeviceController = controller;
}
if (fDeviceController == controller) { if (fDeviceController == controller) {
return fDevice.ChangeState(next); return fDevice.ChangeState(next);

View File

@@ -29,13 +29,17 @@ TEST(EventManager, Basics)
std::function<void(typename TestEvent::KeyType, int)> callback{ std::function<void(typename TestEvent::KeyType, int)> callback{
[&](TestEvent::KeyType key, int newValue){ [&](TestEvent::KeyType key, int newValue){
++call_counter; ++call_counter;
if (key == "test") value = newValue; if (key == "test") {
value = newValue;
}
} }
}; };
std::function<void(typename TestEvent::KeyType, string)> callback2{ std::function<void(typename TestEvent::KeyType, string)> callback2{
[&](TestEvent::KeyType key, string newValue){ [&](TestEvent::KeyType key, string newValue){
++call_counter2; ++call_counter2;
if (key == "test") value2 = newValue; if (key == "test") {
value2 = newValue;
}
} }
}; };