Fix bugprone-unchecked-optional-access findings
Clang-tidy has the aforementioned check, which shows a few places in the
core where we ignored the required optional checks. Fix all uses.
Note, we cannot enable the check that this time because of some weird
code in health.hpp that crashes tidy[1]. That will need to be a future
improvement.
There are tests that call something like
ASSERT(optional)
EXPECT(optional->foo())
While this isn't an actual violation, clang-tidy doesn't seem to be
smart enough to deal with it, so add some explicit checks.
[1] https://github.com/llvm/llvm-project/issues/55530
Tested: Redfish service validator passes.
Change-Id: Ied579cd0b957efc81aff5d5d1091a740a7a2d7e3
Signed-off-by: Ed Tanous <edtanous@google.com>
diff --git a/test/http/verb_test.cpp b/test/http/verb_test.cpp
index aff6ec7..698e39c 100644
--- a/test/http/verb_test.cpp
+++ b/test/http/verb_test.cpp
@@ -27,8 +27,7 @@
{
HttpVerb httpVerb = static_cast<HttpVerb>(verbIndex);
std::optional<HttpVerb> verb = httpVerbFromBoost(verbMap[httpVerb]);
- ASSERT_TRUE(verb.has_value());
- EXPECT_EQ(*verb, httpVerb);
+ EXPECT_EQ(verb, httpVerb);
}
}