Skip to content

Commit

Permalink
chore: remove unnecessary [[nodiscard]] attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
leon0399 committed Aug 4, 2024
1 parent e76662c commit 3852b4d
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 21 deletions.
2 changes: 1 addition & 1 deletion include/senseshift.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Application final : public IEventDispatcher {
public:
Application();

[[nodiscard]] auto getVibroBody() const -> Body::Haptics::FloatBody*
auto getVibroBody() const -> Body::Haptics::FloatBody*

Check warning on line 16 in include/senseshift.h

View check run for this annotation

Codecov / codecov/patch

include/senseshift.h#L16

Added line #L16 was not covered by tests
{
return this->vibro_body_;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/arduino/senseshift/arduino/input/sensor/analog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class AnalogSimpleSensor : public ::SenseShift::Input::IFloatSimpleSensor {
pinMode(this->pin_, INPUT);
}

[[nodiscard]] inline auto getValue() -> float override
inline auto getValue() -> float override

Check warning on line 36 in lib/arduino/senseshift/arduino/input/sensor/analog.hpp

View check run for this annotation

Codecov / codecov/patch

lib/arduino/senseshift/arduino/input/sensor/analog.hpp#L36

Added line #L36 was not covered by tests
{
const std::uint16_t raw = analogRead(this->pin_);
return static_cast<float>(raw) / ANALOG_MAX;
Expand Down
2 changes: 1 addition & 1 deletion lib/arduino/senseshift/arduino/input/sensor/digital.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class DigitalSimpleSensor : public ::SenseShift::Input::IBinarySimpleSensor {
pinMode(this->pin_, this->mode_);
}

[[nodiscard]] auto getValue() -> bool override
auto getValue() -> bool override

Check warning on line 24 in lib/arduino/senseshift/arduino/input/sensor/digital.hpp

View check run for this annotation

Codecov / codecov/patch

lib/arduino/senseshift/arduino/input/sensor/digital.hpp#L24

Added line #L24 was not covered by tests
{
return digitalRead(this->pin_) == this->inverted_;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/arduino_esp32/senseshift/arduino/output/ledc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class LedcOutput : public ::SenseShift::Output::IFloatOutput {
}
}

[[nodiscard]] inline auto getMaxValue() const -> std::uint32_t
inline auto getMaxValue() const -> std::uint32_t

Check warning on line 44 in lib/arduino_esp32/senseshift/arduino/output/ledc.hpp

View check run for this annotation

Codecov / codecov/patch

lib/arduino_esp32/senseshift/arduino/output/ledc.hpp#L44

Added line #L44 was not covered by tests
{
return (1 << this->analog_resolution_) - 1;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/battery/senseshift/battery/input/battery_sensor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class LookupTableInterpolateBatterySensor : public IBatterySensor {
}

protected:
[[nodiscard]] auto lookupInterpolateLevel(VoltageType voltage) -> float
auto lookupInterpolateLevel(VoltageType voltage) -> float
{
return ::SenseShift::lookup_table_interpolate_linear<Container, VoltageType, float>(
*this->lookup_table_,
Expand Down
5 changes: 3 additions & 2 deletions lib/core/senseshift/core/helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ constexpr auto remap_simple(Up value, Up max, Tp max_out) noexcept -> Tp
///
/// \return
template<typename Container, typename Tp = typename Container::key_type, typename To = typename Container::mapped_type>
[[nodiscard]] constexpr auto lookup_table_interpolate_linear(Container const& lookup_table, Tp value) -> To
constexpr auto lookup_table_interpolate_linear(Container const& lookup_table, Tp value) -> To
{
static_assert(std::is_same_v<typename Container::key_type, Tp> && std::is_same_v<typename Container::mapped_type, To>);
static_assert(
Expand Down Expand Up @@ -124,7 +124,8 @@ class CallbackManager<void(Ts...)> {
callback(args...);
}
}
[[nodiscard]] auto size() const -> size_t

auto size() const -> size_t
{
return this->callbacks_.size();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/haptics/senseshift/body/haptics/body.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class OutputBody {

void effect(const Target& target, const Position& pos, const typename Plane::Value& val);

[[nodiscard]] auto getTargets() const -> const TargetPlaneMap*
auto getTargets() const -> const TargetPlaneMap*

Check warning on line 50 in lib/haptics/senseshift/body/haptics/body.hpp

View check run for this annotation

Codecov / codecov/patch

lib/haptics/senseshift/body/haptics/body.hpp#L50

Added line #L50 was not covered by tests
{
return &targets_;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/haptics/senseshift/body/haptics/interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class VibroEffectData {
return this->intensity_;
}

[[nodiscard]] constexpr inline auto getIntensity() const -> Intensity
constexpr inline auto getIntensity() const -> Intensity
{
return intensity_;
}
Expand Down
7 changes: 4 additions & 3 deletions lib/haptics/senseshift/body/haptics/plane.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@ class OutputPlane {
void setup();
virtual void effect(const Position&, const Value&);

[[nodiscard]] auto getAvailablePoints() const -> const PositionSet*
auto getAvailablePoints() const -> const PositionSet*
{
return &points_;
}
[[nodiscard]] auto getActuatorStates() const -> const PositionStateMap*

auto getActuatorStates() const -> const PositionStateMap*
{
return &states_;
}
Expand Down Expand Up @@ -80,7 +81,7 @@ class OutputPlane_Closest : public OutputPlane<Tc, To> {
void effect(const Position&, const Value&) override;

private:
[[nodiscard]] static auto findClosestPoint(const PositionSet&, const Position&) -> const Position&;
static auto findClosestPoint(const PositionSet&, const Position&) -> const Position&;
};

using FloatPlane = OutputPlane<Position::Value, Output::IFloatOutput::ValueType>;
Expand Down
8 changes: 4 additions & 4 deletions lib/io/senseshift/input/sensor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ISimpleSensor : public virtual IInitializable {
explicit ISimpleSensor() = default;

/// Get the current sensor value.
[[nodiscard]] virtual auto getValue() -> ValueType = 0;
virtual auto getValue() -> ValueType = 0;
};

using IBinarySimpleSensor = ISimpleSensor<bool>;
Expand Down Expand Up @@ -86,20 +86,20 @@ class Sensor : public ISensor<Tp> {
}

/// Get the current sensor .value_.
[[nodiscard]] auto getValue() -> ValueType override
auto getValue() -> ValueType override
{
return this->value_;
}

/// Get the current raw sensor .raw_value_.
[[nodiscard]] auto getRawValue() -> ValueType
auto getRawValue() -> ValueType
{
return this->raw_value_;
}

protected:
/// Apply current filters to value.
[[nodiscard]] auto applyFilters(ValueType value) -> ValueType
auto applyFilters(ValueType value) -> ValueType
{
/// Apply calibration
if (this->getCalibrator() != nullptr) {
Expand Down
6 changes: 3 additions & 3 deletions lib/opengloves/senseshift/opengloves/autoconfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@

namespace SenseShift::OpenGloves::AutoConfig {

[[nodiscard]] auto createInput() -> InputSensors
auto createInput() -> InputSensors

Check warning on line 265 in lib/opengloves/senseshift/opengloves/autoconfig.hpp

View check run for this annotation

Codecov / codecov/patch

lib/opengloves/senseshift/opengloves/autoconfig.hpp#L265

Added line #L265 was not covered by tests
{
InputSensors input_sensors;

Expand Down Expand Up @@ -406,7 +406,7 @@ namespace SenseShift::OpenGloves::AutoConfig {
return input_sensors;
}

[[nodiscard]] auto createFfbOutputs() -> OutputWriters
auto createFfbOutputs() -> OutputWriters

Check warning on line 409 in lib/opengloves/senseshift/opengloves/autoconfig.hpp

View check run for this annotation

Codecov / codecov/patch

lib/opengloves/senseshift/opengloves/autoconfig.hpp#L409

Added line #L409 was not covered by tests
{
OutputWriters output_writers;

Expand Down Expand Up @@ -441,7 +441,7 @@ namespace SenseShift::OpenGloves::AutoConfig {
/**
* Setup the transport for the OpenGloves interface.
*/
[[nodiscard]] auto createTransport() -> ITransport*
auto createTransport() -> ITransport*

Check warning on line 444 in lib/opengloves/senseshift/opengloves/autoconfig.hpp

View check run for this annotation

Codecov / codecov/patch

lib/opengloves/senseshift/opengloves/autoconfig.hpp#L444

Added line #L444 was not covered by tests
{
#if OPENGLOVES_COMMUNICATION == OPENGLOVES_COMM_SERIAL // Serial
auto* pSerial = &SERIAL_PORT;
Expand Down
4 changes: 2 additions & 2 deletions lib/opengloves/senseshift/opengloves/opengloves.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,12 @@ class InputSensors : public og::InputPeripheral<FloatSensor*, BinarySensor*> {
}
}

[[nodiscard]] auto collectData() -> og::InputPeripheralData
auto collectData() -> og::InputPeripheralData

Check warning on line 137 in lib/opengloves/senseshift/opengloves/opengloves.hpp

View check run for this annotation

Codecov / codecov/patch

lib/opengloves/senseshift/opengloves/opengloves.hpp#L137

Added line #L137 was not covered by tests
{
SS_OG_COLLECT_DATA(getValue);
}

[[nodiscard]] auto collectRawData() -> og::InputPeripheralData
auto collectRawData() -> og::InputPeripheralData
{
SS_OG_COLLECT_DATA(getRawValue);
}
Expand Down

0 comments on commit 3852b4d

Please sign in to comment.