mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +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:
@@ -63,7 +63,9 @@ void AddressableLEDsModel::Update() {
|
||||
if (!model) {
|
||||
model = std::make_unique<AddressableLEDModel>(i);
|
||||
}
|
||||
if (model) model->Update();
|
||||
if (model) {
|
||||
model->Update();
|
||||
}
|
||||
} else {
|
||||
model.reset();
|
||||
}
|
||||
@@ -72,7 +74,9 @@ void AddressableLEDsModel::Update() {
|
||||
|
||||
bool AddressableLEDsModel::Exists() {
|
||||
for (auto&& model : m_models) {
|
||||
if (model && model->Exists()) return true;
|
||||
if (model && model->Exists()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -80,14 +84,18 @@ bool AddressableLEDsModel::Exists() {
|
||||
void AddressableLEDsModel::ForEachLEDDisplay(
|
||||
wpi::function_ref<void(glass::LEDDisplayModel& model, int index)> func) {
|
||||
for (int i = 0; i < static_cast<int>(m_models.size()); ++i) {
|
||||
if (m_models[i]) func(*m_models[i], i);
|
||||
if (m_models[i]) {
|
||||
func(*m_models[i], i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static bool AddressableLEDsExists() {
|
||||
static const int numLED = HAL_GetNumAddressableLEDs();
|
||||
for (int i = 0; i < numLED; ++i) {
|
||||
if (HALSIM_GetAddressableLEDInitialized(i)) return true;
|
||||
if (HALSIM_GetAddressableLEDInitialized(i)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user