mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41: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:
@@ -42,7 +42,9 @@ void glass::DisplayLEDDisplay(LEDDisplayModel* model, int index) {
|
||||
ImGui::Combo("Start", start, options, 4);
|
||||
}
|
||||
ImGui::Checkbox("Serpentine", serpentine);
|
||||
if (*numColumns < 1) *numColumns = 1;
|
||||
if (*numColumns < 1) {
|
||||
*numColumns = 1;
|
||||
}
|
||||
ImGui::PopItemWidth();
|
||||
|
||||
// show as LED indicators
|
||||
@@ -51,13 +53,17 @@ void glass::DisplayLEDDisplay(LEDDisplayModel* model, int index) {
|
||||
storage.SetData(std::make_shared<IndicatorData>());
|
||||
iData = storage.GetData<IndicatorData>();
|
||||
}
|
||||
if (length > static_cast<int>(iData->values.size()))
|
||||
if (length > static_cast<int>(iData->values.size())) {
|
||||
iData->values.resize(length);
|
||||
if (length > static_cast<int>(iData->colors.size()))
|
||||
}
|
||||
if (length > static_cast<int>(iData->colors.size())) {
|
||||
iData->colors.resize(length);
|
||||
}
|
||||
if (!running) {
|
||||
iData->colors[0] = IM_COL32(128, 128, 128, 255);
|
||||
for (int j = 0; j < length; ++j) iData->values[j] = -1;
|
||||
for (int j = 0; j < length; ++j) {
|
||||
iData->values[j] = -1;
|
||||
}
|
||||
} else {
|
||||
for (int j = 0; j < length; ++j) {
|
||||
iData->values[j] = j + 1;
|
||||
@@ -79,10 +85,14 @@ void glass::DisplayLEDDisplays(LEDDisplaysModel* model) {
|
||||
|
||||
model->ForEachLEDDisplay([&](LEDDisplayModel& display, int i) {
|
||||
hasAny = true;
|
||||
if (model->GetNumLEDDisplays() > 1) ImGui::Text("LEDs[%d]", i);
|
||||
if (model->GetNumLEDDisplays() > 1) {
|
||||
ImGui::Text("LEDs[%d]", i);
|
||||
}
|
||||
PushID(i);
|
||||
DisplayLEDDisplay(&display, i);
|
||||
PopID();
|
||||
});
|
||||
if (!hasAny) ImGui::Text("No addressable LEDs");
|
||||
if (!hasAny) {
|
||||
ImGui::Text("No addressable LEDs");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user