fix: address clang-tidy warnings (#5915)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
boost::json::result_for<{{enum.full_name}}, boost::json::value>::type tag_invoke(
|
||||
boost::json::try_value_to_tag<{{enum.full_name}}>, const boost::json::value &jvRoot)
|
||||
boost::json::try_value_to_tag<{{enum.full_name}}> /* tag */, const boost::json::value &jvRoot)
|
||||
{
|
||||
if (!jvRoot.is_string())
|
||||
{
|
||||
|
||||
@@ -21,7 +21,11 @@ if (jv{{field.name}} != nullptr && !jv{{field.name}}->is_null())
|
||||
{
|
||||
return t{{field.name}}.error();
|
||||
}
|
||||
{% if field.trivial -%}
|
||||
{{field.name}} = t{{field.name}}.value();
|
||||
{%- else -%}
|
||||
{{field.name}} = std::move(t{{field.name}}.value());
|
||||
{%- endif %}
|
||||
{% endif %}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ if (jv{{field.name}} == nullptr)
|
||||
{
|
||||
{% include 'error-missing-field.tmpl' indent content %}
|
||||
}
|
||||
const auto {{field.name}} = boost::json::try_value_to<std::vector<{{field.type_name}}>>(*jv{{field.name}});
|
||||
auto {{field.name}} = boost::json::try_value_to<std::vector<{{field.type_name}}>>(*jv{{field.name}});
|
||||
if ({{field.name}}.has_error())
|
||||
{
|
||||
{% include 'error-failed-to-deserialize.tmpl' indent content %}
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
{%- if field.trivial -%}
|
||||
.{{field.name}} = {{field.name}}.value(),
|
||||
{%- else -%}
|
||||
.{{field.name}} = std::move({{field.name}}.value()),
|
||||
{%- endif -%}
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
{%- if field.trivial -%}
|
||||
.{{field.name}} = {{field.name}},
|
||||
{%- else -%}
|
||||
.{{field.name}} = std::move({{field.name}}),
|
||||
{%- endif -%}
|
||||
|
||||
@@ -1 +1 @@
|
||||
.{{field.name}} = {{field.name}}.value(),
|
||||
.{{field.name}} = std::move({{field.name}}.value()),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
boost::json::result_for<{{struct.full_name}}, boost::json::value>::type tag_invoke(
|
||||
boost::json::try_value_to_tag<{{struct.full_name}}>, const boost::json::value &jvRoot)
|
||||
boost::json::try_value_to_tag<{{struct.full_name}}> /* tag */, const boost::json::value &jvRoot)
|
||||
{
|
||||
{% if struct.inner_root %}
|
||||
if (!jvRoot.is_object())
|
||||
@@ -18,7 +18,7 @@ boost::json::result_for<{{struct.full_name}}, boost::json::value>::type tag_invo
|
||||
EVENTSUB_BAIL_HERE(error::Kind::ExpectedObject);
|
||||
}
|
||||
const auto &root = jvInnerRoot->get_object();
|
||||
{% else %}
|
||||
{% elif struct.members|length %}
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
EVENTSUB_BAIL_HERE(error::Kind::ExpectedObject);
|
||||
@@ -27,6 +27,9 @@ boost::json::result_for<{{struct.full_name}}, boost::json::value>::type tag_invo
|
||||
{% endif %}
|
||||
|
||||
{% for field in struct.members %}
|
||||
{% if field.trivial -%}
|
||||
static_assert(std::is_trivially_copyable_v<std::remove_reference_t<decltype(std::declval<{{struct.full_name}}>().{{field.name}})>>);
|
||||
{%- endif -%}
|
||||
{% if field.member_type == MemberType.BASIC -%}
|
||||
{% include 'field-basic.tmpl' indent content %}
|
||||
{%- elif field.member_type == MemberType.VECTOR -%}
|
||||
|
||||
Reference in New Issue
Block a user