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:
Peter Johnson
2020-12-28 12:58:06 -08:00
committed by GitHub
parent 0291a3ff56
commit 2aed432b4b
634 changed files with 10716 additions and 3938 deletions

View File

@@ -26,7 +26,9 @@ NetworkTablesSettings::NetworkTablesSettings(NT_Inst inst,
}
void NetworkTablesSettings::Update() {
if (!m_restart) return;
if (!m_restart) {
return;
}
m_restart = false;
nt::StopClient(m_inst);
nt::StopServer(m_inst);
@@ -40,8 +42,9 @@ void NetworkTablesSettings::Update() {
wpi::SmallVector<wpi::StringRef, 4> serverNames;
wpi::SmallVector<std::pair<wpi::StringRef, unsigned int>, 4> servers;
serverTeam.split(serverNames, ',', -1, false);
for (auto&& serverName : serverNames)
for (auto&& serverName : serverNames) {
servers.emplace_back(serverName, NT_DEFAULT_PORT);
}
nt::StartClient(m_inst, servers);
}
} else if (*m_pMode == 2) {
@@ -64,5 +67,7 @@ void NetworkTablesSettings::Display() {
default:
break;
}
if (ImGui::Button("Apply")) m_restart = true;
if (ImGui::Button("Apply")) {
m_restart = true;
}
}