refactor: Add simple clang-tidy readability checks (#6556)

This change enables the following clang-tidy checks:
-  readability-avoid-nested-conditional-operator,
-  readability-avoid-return-with-void-value,
-  readability-braces-around-statements,
-  readability-const-return-type,
-  readability-container-contains,
-  readability-container-size-empty,
-  readability-else-after-return,
-  readability-make-member-function-const,
-  readability-redundant-casting,
-  readability-redundant-inline-specifier,
-  readability-redundant-member-init,
-  readability-redundant-string-init,
-  readability-reference-to-constructed-temporary,
-  readability-static-definition
This commit is contained in:
Alex Kremer
2026-03-18 16:41:49 +00:00
committed by GitHub
parent b92a9a3053
commit 57e4cbbcd9
328 changed files with 4415 additions and 1176 deletions

View File

@@ -112,8 +112,10 @@ Serializer::addFieldID(int type, int name)
if (type < 16)
{
if (name < 16) // common type, common name
if (name < 16)
{ // common type, common name
mData.push_back(static_cast<unsigned char>((type << 4) | name));
}
else
{
// common type, uncommon name
@@ -187,7 +189,7 @@ int
Serializer::addVL(Slice const& slice)
{
int ret = addEncoded(slice.size());
if (slice.size())
if (!slice.empty())
addRaw(slice.data(), slice.size());
return ret;
}
@@ -230,7 +232,9 @@ Serializer::addEncoded(int length)
numBytes = 3;
}
else
{
Throw<std::overflow_error>("lenlen");
}
return addRaw(&bytes[0], numBytes);
}