mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Replace static_cast<void>() with [[maybe_unused]] attribute (#5892)
This clarifies intent. Not done for thirdparty libraries or structured binding variables.
This commit is contained in:
@@ -16,20 +16,17 @@ class MoveOnlyType {
|
||||
} // namespace
|
||||
|
||||
TEST(ArrayTest, CopyableTypeCompiles) {
|
||||
constexpr wpi::array<int, 3> arr1{1, 2, 3};
|
||||
static_cast<void>(arr1);
|
||||
[[maybe_unused]] constexpr wpi::array<int, 3> arr1{1, 2, 3};
|
||||
|
||||
// Test deduction guide
|
||||
constexpr wpi::array arr2{1, 2, 3};
|
||||
static_cast<void>(arr2);
|
||||
[[maybe_unused]] constexpr wpi::array arr2{1, 2, 3};
|
||||
}
|
||||
|
||||
TEST(ArrayTest, MoveOnlyTypeCompiles) {
|
||||
constexpr wpi::array<MoveOnlyType, 3> arr1{MoveOnlyType{}, MoveOnlyType{},
|
||||
MoveOnlyType{}};
|
||||
static_cast<void>(arr1);
|
||||
[[maybe_unused]] constexpr wpi::array<MoveOnlyType, 3> arr1{
|
||||
MoveOnlyType{}, MoveOnlyType{}, MoveOnlyType{}};
|
||||
|
||||
// Test deduction guide
|
||||
constexpr wpi::array arr2{MoveOnlyType{}, MoveOnlyType{}, MoveOnlyType{}};
|
||||
static_cast<void>(arr2);
|
||||
[[maybe_unused]] constexpr wpi::array arr2{MoveOnlyType{}, MoveOnlyType{},
|
||||
MoveOnlyType{}};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user