mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[commands] Mark CommandPtr class as [[nodiscard]] (#7803)
This has the same effect but makes it so any user code returning CommandPtr can't discard a returned command. Signed-off-by: Eric Ward <ezeward4@gmail.com>
This commit is contained in:
@@ -82,7 +82,6 @@ class DriveSubsystem : public frc2::SubsystemBase {
|
||||
* @param distance The distance to drive forward.
|
||||
* @return A command.
|
||||
*/
|
||||
[[nodiscard]]
|
||||
frc2::CommandPtr ProfiledDriveDistance(units::meter_t distance);
|
||||
|
||||
/**
|
||||
@@ -92,7 +91,6 @@ class DriveSubsystem : public frc2::SubsystemBase {
|
||||
* @param distance The distance to drive forward.
|
||||
* @return A command.
|
||||
*/
|
||||
[[nodiscard]]
|
||||
frc2::CommandPtr DynamicProfiledDriveDistance(units::meter_t distance);
|
||||
|
||||
private:
|
||||
|
||||
@@ -28,7 +28,6 @@ class Drive : public frc2::SubsystemBase {
|
||||
* @param fwd the commanded forward movement
|
||||
* @param rot the commanded rotation
|
||||
*/
|
||||
[[nodiscard]]
|
||||
frc2::CommandPtr ArcadeDriveCommand(std::function<double()> fwd,
|
||||
std::function<double()> rot);
|
||||
|
||||
@@ -39,7 +38,6 @@ class Drive : public frc2::SubsystemBase {
|
||||
* @param distance The distance to drive forward in meters
|
||||
* @param speed The fraction of max speed at which to drive
|
||||
*/
|
||||
[[nodiscard]]
|
||||
frc2::CommandPtr DriveDistanceCommand(units::meter_t distance, double speed);
|
||||
|
||||
/**
|
||||
@@ -48,7 +46,6 @@ class Drive : public frc2::SubsystemBase {
|
||||
*
|
||||
* @param angle The angle to turn to
|
||||
*/
|
||||
[[nodiscard]]
|
||||
frc2::CommandPtr TurnToAngleCommand(units::degree_t angle);
|
||||
|
||||
private:
|
||||
|
||||
@@ -19,11 +19,9 @@ class Intake : public frc2::SubsystemBase {
|
||||
|
||||
/** Returns a command that deploys the intake, and then runs the intake motor
|
||||
* indefinitely. */
|
||||
[[nodiscard]]
|
||||
frc2::CommandPtr IntakeCommand();
|
||||
|
||||
/** Returns a command that turns off and retracts the intake. */
|
||||
[[nodiscard]]
|
||||
frc2::CommandPtr RetractCommand();
|
||||
|
||||
private:
|
||||
|
||||
@@ -17,7 +17,6 @@ class Pneumatics : frc2::SubsystemBase {
|
||||
public:
|
||||
Pneumatics();
|
||||
/** Returns a command that disables the compressor indefinitely. */
|
||||
[[nodiscard]]
|
||||
frc2::CommandPtr DisableCompressorCommand();
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,7 +28,6 @@ class Shooter : public frc2::SubsystemBase {
|
||||
*
|
||||
* @param setpointRotationsPerSecond The desired shooter velocity
|
||||
*/
|
||||
[[nodiscard]]
|
||||
frc2::CommandPtr ShootCommand(units::turns_per_second_t setpoint);
|
||||
|
||||
private:
|
||||
|
||||
@@ -16,7 +16,6 @@ class Storage : frc2::SubsystemBase {
|
||||
public:
|
||||
Storage();
|
||||
/** Returns a command that runs the storage motor indefinitely. */
|
||||
[[nodiscard]]
|
||||
frc2::CommandPtr RunCommand();
|
||||
|
||||
/** Whether the ball storage is full. */
|
||||
|
||||
Reference in New Issue
Block a user