[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

@@ -38,5 +38,6 @@ TEST_F(CommandPtrTest, MovedFrom) {
}
TEST_F(CommandPtrTest, NullInitialization) {
EXPECT_THROW(CommandPtr{std::unique_ptr<Command>{}}, frc::RuntimeError);
EXPECT_THROW(auto cmd = CommandPtr{std::unique_ptr<Command>{}},
frc::RuntimeError);
}