mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-02 02:51:42 +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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user