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

@@ -85,7 +85,9 @@ Trajectory TrajectoryParameterizer::TimeParameterizeTrajectory(
// Now enforce all acceleration limits.
EnforceAccelerationLimits(reversed, constraints, &constrainedState);
if (ds.to<double>() < kEpsilon) break;
if (ds.to<double>() < kEpsilon) {
break;
}
// If the actual acceleration for this state is higher than the max
// acceleration that we applied, then we need to reduce the max
@@ -130,14 +132,18 @@ Trajectory TrajectoryParameterizer::TimeParameterizeTrajectory(
successor.minAcceleration * ds * 2.0);
// No more limits to impose! This state can be finalized.
if (newMaxVelocity >= constrainedState.maxVelocity) break;
if (newMaxVelocity >= constrainedState.maxVelocity) {
break;
}
constrainedState.maxVelocity = newMaxVelocity;
// Check all acceleration constraints with the new max velocity.
EnforceAccelerationLimits(reversed, constraints, &constrainedState);
if (ds.to<double>() > -kEpsilon) break;
if (ds.to<double>() > -kEpsilon) {
break;
}
// If the actual acceleration for this state is lower than the min
// acceleration, then we need to lower the min acceleration of the