pw_string: Fix dead initialization in tests
Change-Id: Ie206705a78db14eb246ce80f1aff350942656aa5
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/35561
Pigweed-Auto-Submit: Prashanth Swaminathan <prashanthsw@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
diff --git a/pw_string/string_builder_test.cc b/pw_string/string_builder_test.cc
index ee8bad5..c3bc3b0 100644
--- a/pw_string/string_builder_test.cc
+++ b/pw_string/string_builder_test.cc
@@ -521,10 +521,11 @@
TEST(MakeString, StringLiteral_ResizesToFitWholeLiteral) {
EXPECT_STREQ("", MakeString().data());
- auto normal = MakeString("");
+ [[maybe_unused]] auto normal = MakeString("");
static_assert(normal.max_size() == decltype(MakeString(1))::max_size());
- auto resized = MakeString("This string is reeeeeeeeeaaaaallly long!!!!!");
+ [[maybe_unused]] auto resized =
+ MakeString("This string is reeeeeeeeeaaaaallly long!!!!!");
static_assert(resized.max_size() > decltype(MakeString(1))::max_size());
static_assert(resized.max_size() ==
sizeof("This string is reeeeeeeeeaaaaallly long!!!!!") - 1);