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:
@@ -32,16 +32,21 @@ static void DisplayTiming() {
|
||||
int32_t status = 0;
|
||||
uint64_t curTime = HAL_GetFPGATime(&status);
|
||||
|
||||
if (ImGui::Button("Run")) HALSIM_ResumeTiming();
|
||||
if (ImGui::Button("Run")) {
|
||||
HALSIM_ResumeTiming();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Pause")) HALSIM_PauseTiming();
|
||||
if (ImGui::Button("Pause")) {
|
||||
HALSIM_PauseTiming();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::PushButtonRepeat(true);
|
||||
if (ImGui::Button("Step")) {
|
||||
HALSIM_PauseTiming();
|
||||
uint64_t nextTimeout = HALSIM_GetNextNotifierTimeout();
|
||||
if (nextTimeout != UINT64_MAX)
|
||||
if (nextTimeout != UINT64_MAX) {
|
||||
HALSIM_StepTimingAsync(nextTimeout - curTime);
|
||||
}
|
||||
}
|
||||
ImGui::PopButtonRepeat();
|
||||
ImGui::PushItemWidth(ImGui::GetFontSize() * 4);
|
||||
@@ -54,11 +59,14 @@ static void DisplayTiming() {
|
||||
notifiers.resize(num);
|
||||
HALSIM_GetNotifierInfo(notifiers.data(), notifiers.size());
|
||||
}
|
||||
if (num > 0) ImGui::Separator();
|
||||
if (num > 0) {
|
||||
ImGui::Separator();
|
||||
}
|
||||
ImGui::PushItemWidth(ImGui::GetFontSize() * 4);
|
||||
for (int32_t i = 0; i < num; ++i)
|
||||
for (int32_t i = 0; i < num; ++i) {
|
||||
ImGui::LabelText(notifiers[i].name, "%.3f",
|
||||
notifiers[i].timeout / 1000000.0);
|
||||
}
|
||||
ImGui::PopItemWidth();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user