clang-tidy: google-explicit-constructor

This commit is contained in:
Peter Johnson
2020-12-28 11:18:07 -08:00
parent c97c6dc065
commit cbe59fa3bf
15 changed files with 26 additions and 24 deletions

View File

@@ -65,8 +65,9 @@ class SerialPort : public ErrorBase {
* @param stopBits The number of stop bits to use as defined by the enum
* StopBits.
*/
SerialPort(int baudRate, Port port = kOnboard, int dataBits = 8,
Parity parity = kParity_None, StopBits stopBits = kStopBits_One);
explicit SerialPort(int baudRate, Port port = kOnboard, int dataBits = 8,
Parity parity = kParity_None,
StopBits stopBits = kStopBits_One);
/**
* Create an instance of a Serial Port class.

View File

@@ -36,8 +36,9 @@ class LinearSystemSim {
* @param system The system to simulate.
* @param measurementStdDevs The standard deviations of the measurements.
*/
LinearSystemSim(const LinearSystem<States, Inputs, Outputs>& system,
const std::array<double, Outputs>& measurementStdDevs = {})
explicit LinearSystemSim(
const LinearSystem<States, Inputs, Outputs>& system,
const std::array<double, Outputs>& measurementStdDevs = {})
: m_plant(system), m_measurementStdDevs(measurementStdDevs) {
m_x = Eigen::Matrix<double, States, 1>::Zero();
m_y = Eigen::Matrix<double, Outputs, 1>::Zero();

View File

@@ -34,12 +34,12 @@ class Color8Bit {
*
* @param color The color
*/
constexpr Color8Bit(const Color& color)
constexpr Color8Bit(const Color& color) // NOLINT
: red(color.red * 255),
green(color.green * 255),
blue(color.blue * 255) {}
constexpr operator Color() const {
constexpr operator Color() const { // NOLINT
return Color(red / 255.0, green / 255.0, blue / 255.0);
}