[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:
Eric
2025-05-03 23:44:55 -04:00
committed by GitHub
parent 02de5f710e
commit 17cae787e7
11 changed files with 5 additions and 84 deletions

View File

@@ -127,7 +127,6 @@ class Subsystem {
*
* @param action the action to run
*/
[[nodiscard]]
CommandPtr RunOnce(std::function<void()> action);
/**
@@ -136,7 +135,6 @@ class Subsystem {
*
* @param action the action to run
*/
[[nodiscard]]
CommandPtr Run(std::function<void()> action);
/**
@@ -146,7 +144,6 @@ class Subsystem {
* @param start the action to run on start
* @param end the action to run on interrupt
*/
[[nodiscard]]
CommandPtr StartEnd(std::function<void()> start, std::function<void()> end);
/**
@@ -156,7 +153,6 @@ class Subsystem {
* @param run the action to run every iteration
* @param end the action to run on interrupt
*/
[[nodiscard]]
CommandPtr RunEnd(std::function<void()> run, std::function<void()> end);
/**
@@ -166,7 +162,6 @@ class Subsystem {
* @param start the action to run on start
* @param run the action to run every iteration
*/
[[nodiscard]]
CommandPtr StartRun(std::function<void()> start, std::function<void()> run);
/**
@@ -176,7 +171,6 @@ class Subsystem {
* @param supplier the command supplier.
* @return the command.
*/
[[nodiscard]]
CommandPtr Defer(wpi::unique_function<CommandPtr()> supplier);
};
} // namespace frc2