{%- if has_stripped_cfg_fields %}
#[allow(clippy::needless_update)]
{%- endif %}
{%- if uses_builder_pattern %}
#[allow(clippy::field_reassign_with_default, clippy::let_and_return)]
{%- endif %}
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
impl From<{{ binding_name }}> for {{ core_path }}{% if has_lifetime_params %}<'_>{% endif %} {
    fn from(val: {{ binding_name }}) -> Self {
        {%- if is_newtype %}
        Self({{ newtype_inner_expr }})
        {%- elif has_explicit_static_new %}
        let _ = val;
        compile_error!("alef cannot generate From<{{ binding_name }}> for {{ core_path }} because construction requires private or borrowed fields; expose a complete constructor, configure the item as opaque, or exclude it from this backend")
        {%- elif builder_mode %}
        let mut __result = {{ core_path }}::default();
        {%- for statement in statements %}
        {{ statement }}
        {%- endfor %}
        __result
        {%- else %}
        Self {
            {%- for field in fields %}
            {{ field }},
            {%- endfor %}
            {%- if has_stripped_cfg_fields %}
            ..Default::default()
            {%- endif %}
        }
        {%- endif %}
    }
}
