diff --git a/.clang-format b/.clang-format index 30cd57f..a858fb6 100644 --- a/.clang-format +++ b/.clang-format @@ -76,7 +76,7 @@ AllowShortEnumsOnASingleLine: false AllowShortBlocksOnASingleLine: Never AllowShortCaseLabelsOnASingleLine: false AllowShortFunctionsOnASingleLine: None -AllowShortLambdasOnASingleLine: All +AllowShortLambdasOnASingleLine: false AllowShortIfStatementsOnASingleLine: Never AllowShortLoopsOnASingleLine: false AlwaysBreakAfterDefinitionReturnType: None diff --git a/runtime/src/zserio/HashCodeUtil.h b/runtime/src/zserio/HashCodeUtil.h index 3ff28d5..722813b 100644 --- a/runtime/src/zserio/HashCodeUtil.h +++ b/runtime/src/zserio/HashCodeUtil.h @@ -123,13 +123,13 @@ inline typename std::enable_if::value, uint32_t>::type c } /** -* Calculates hash code of the given Zserio object (structure, choice, ...) using the given seed value. -* -* \param seedValue Seed value (current hash code). -* \param object Object for which to calculate the hash code. -* -* \return Calculated hash code. -*/ + * Calculates hash code of the given Zserio object (structure, choice, ...) using the given seed value. + * + * \param seedValue Seed value (current hash code). + * \param object Object for which to calculate the hash code. + * + * \return Calculated hash code. + */ template inline typename std::enable_if::value && !std::is_integral::value, uint32_t>::type calcHashCode(uint32_t seedValue, const OBJECT& object) diff --git a/runtime/src/zserio/Variant.h b/runtime/src/zserio/Variant.h index b76ce4a..9ced0f5 100644 --- a/runtime/src/zserio/Variant.h +++ b/runtime/src/zserio/Variant.h @@ -688,11 +688,9 @@ uint32_t calcHashCode(uint32_t seed, const BasicVariant& var { uint32_t result = seed; result = zserio::calcHashCode(result, static_cast(var.index())); - var.visit( - [&result](const auto& value) - { - result = zserio::calcHashCode(result, value); - }); + var.visit([&result](const auto& value) { + result = zserio::calcHashCode(result, value); + }); return result; } diff --git a/runtime/test/zserio/VariantTest.cpp b/runtime/test/zserio/VariantTest.cpp index 1421908..d67346b 100644 --- a/runtime/test/zserio/VariantTest.cpp +++ b/runtime/test/zserio/VariantTest.cpp @@ -1,10 +1,10 @@ #include +#include #include "gtest/gtest.h" #include "zserio/HashCodeUtil.h" #include "zserio/TrackingAllocator.h" #include "zserio/Variant.h" -#include // helper type for the visitor template @@ -225,28 +225,23 @@ TYPED_TEST(VariantTest, visit) Variant1 var; var.emplace("something"); - var.visit( - [](auto&& val) - { - using T = std::decay_t; - ASSERT_TRUE((std::is_same_v)); - }); + var.visit([](auto&& val) { + using T = std::decay_t; + ASSERT_TRUE((std::is_same_v)); + }); - var.visit(overloaded{[](std::string& i) - { - SUCCEED(); - }, - [](auto&&) - { + var.visit(overloaded{[](std::string& i) { + SUCCEED(); + }, + [](auto&&) { FAIL(); }}); - int ret = var.visit(overloaded{[](std::string& i) - { + int ret = var.visit(overloaded{ + [](std::string& i) { return 1; }, - [](auto&&) - { + [](auto&&) { return 0; }}); ASSERT_EQ(ret, 1); @@ -302,9 +297,10 @@ namespace std template <> struct hash { - size_t operator()(const zserio::BigObj& ) const { + size_t operator()(const zserio::BigObj&) const + { return 0; } }; -} \ No newline at end of file +} // namespace std \ No newline at end of file