mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-28 02:11:43 +00:00
clang-tidy: google-explicit-constructor
This commit is contained in:
@@ -34,7 +34,7 @@ class Image {
|
||||
Image& operator=(const Image&) = delete;
|
||||
|
||||
// Getters
|
||||
operator wpi::StringRef() const { return str(); }
|
||||
operator wpi::StringRef() const { return str(); } // NOLINT
|
||||
wpi::StringRef str() const { return wpi::StringRef(data(), size()); }
|
||||
size_t capacity() const { return m_data.capacity(); }
|
||||
const char* data() const {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace cs {
|
||||
class WindowsMessagePump {
|
||||
public:
|
||||
WindowsMessagePump(
|
||||
explicit WindowsMessagePump(
|
||||
std::function<LRESULT(HWND, UINT, WPARAM, LPARAM)> callback);
|
||||
~WindowsMessagePump();
|
||||
|
||||
|
||||
@@ -322,7 +322,7 @@ class SimValue {
|
||||
*
|
||||
* @return internal handle
|
||||
*/
|
||||
operator HAL_SimValueHandle() const { return m_handle; }
|
||||
operator HAL_SimValueHandle() const { return m_handle; } // NOLINT
|
||||
|
||||
/**
|
||||
* Gets the simulated value.
|
||||
@@ -544,7 +544,7 @@ class SimDevice {
|
||||
*
|
||||
* @return internal handle
|
||||
*/
|
||||
operator HAL_SimDeviceHandle() const { return m_handle; }
|
||||
operator HAL_SimDeviceHandle() const { return m_handle; } // NOLINT
|
||||
|
||||
/**
|
||||
* Creates a value on the simulated device.
|
||||
|
||||
@@ -96,7 +96,7 @@ class Handle {
|
||||
return *this;
|
||||
}
|
||||
|
||||
operator CType() const { return m_handle; }
|
||||
operator CType() const { return m_handle; } // NOLINT
|
||||
|
||||
private:
|
||||
CType m_handle = CInvalid;
|
||||
|
||||
@@ -28,7 +28,7 @@ class SimDataValueBase : protected SimCallbackRegistryBase {
|
||||
return m_value;
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE operator T() const { return Get(); }
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE operator T() const { return Get(); } // NOLINT
|
||||
|
||||
void Reset(T value) {
|
||||
std::scoped_lock lock(m_mutex);
|
||||
|
||||
@@ -296,7 +296,7 @@ class Texture {
|
||||
/**
|
||||
* Implicit conversion to ImTextureID.
|
||||
*/
|
||||
operator ImTextureID() const { return m_texture; }
|
||||
operator ImTextureID() const { return m_texture; } // NOLINT
|
||||
|
||||
/**
|
||||
* Gets the texture pixel format.
|
||||
|
||||
@@ -37,8 +37,8 @@ class InstantCommand : public CommandHelper<CommandBase, InstantCommand> {
|
||||
* @param toRun the Runnable to run
|
||||
* @param requirements the subsystems required by this command
|
||||
*/
|
||||
InstantCommand(std::function<void()> toRun,
|
||||
wpi::ArrayRef<Subsystem*> requirements = {});
|
||||
explicit InstantCommand(std::function<void()> toRun,
|
||||
wpi::ArrayRef<Subsystem*> requirements = {});
|
||||
|
||||
InstantCommand(InstantCommand&& other) = default;
|
||||
|
||||
|
||||
@@ -38,8 +38,8 @@ class RunCommand : public CommandHelper<CommandBase, RunCommand> {
|
||||
* @param toRun the Runnable to run
|
||||
* @param requirements the subsystems to require
|
||||
*/
|
||||
RunCommand(std::function<void()> toRun,
|
||||
wpi::ArrayRef<Subsystem*> requirements = {});
|
||||
explicit RunCommand(std::function<void()> toRun,
|
||||
wpi::ArrayRef<Subsystem*> requirements = {});
|
||||
|
||||
RunCommand(RunCommand&& other) = default;
|
||||
|
||||
|
||||
@@ -48,8 +48,8 @@ class SelectCommand : public CommandHelper<CommandBase, SelectCommand<Key>> {
|
||||
template <class... Types,
|
||||
typename = std::enable_if_t<std::conjunction_v<
|
||||
std::is_base_of<Command, std::remove_reference_t<Types>>...>>>
|
||||
SelectCommand(std::function<Key()> selector,
|
||||
std::pair<Key, Types>... commands)
|
||||
explicit SelectCommand(std::function<Key()> selector,
|
||||
std::pair<Key, Types>... commands)
|
||||
: m_selector{std::move(selector)} {
|
||||
std::vector<std::pair<Key, std::unique_ptr<Command>>> foo;
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,8 +37,8 @@ class MerweScaledSigmaPoints {
|
||||
* For Gaussian distributions, beta = 2 is optimal.
|
||||
* @param kappa Secondary scaling parameter usually set to 0 or 3 - States.
|
||||
*/
|
||||
MerweScaledSigmaPoints(double alpha = 1e-3, double beta = 2,
|
||||
int kappa = 3 - States) {
|
||||
explicit MerweScaledSigmaPoints(double alpha = 1e-3, double beta = 2,
|
||||
int kappa = 3 - States) {
|
||||
m_alpha = alpha;
|
||||
m_kappa = kappa;
|
||||
|
||||
|
||||
@@ -287,7 +287,7 @@ class future final {
|
||||
future(const future&) = delete;
|
||||
|
||||
template <typename R>
|
||||
future(future<R>&& oth) noexcept
|
||||
future(future<R>&& oth) noexcept // NOLINT
|
||||
: future(oth.then([](R&& val) -> T { return val; })) {}
|
||||
|
||||
/**
|
||||
|
||||
@@ -46,8 +46,8 @@ class Buffer : public uv_buf_t {
|
||||
ArrayRef<char> data() const { return ArrayRef<char>{base, len}; }
|
||||
MutableArrayRef<char> data() { return MutableArrayRef<char>{base, len}; }
|
||||
|
||||
operator ArrayRef<char>() const { return data(); }
|
||||
operator MutableArrayRef<char>() { return data(); }
|
||||
operator ArrayRef<char>() const { return data(); } // NOLINT
|
||||
operator MutableArrayRef<char>() { return data(); } // NOLINT
|
||||
|
||||
static Buffer Allocate(size_t size) { return Buffer{new char[size], size}; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user