askama
askama copied to clipboard
Unnecessary fields required when using blocks for partial rendering
Given a template like this:
templates/base.html
{% block empty %}
{% endblock %}
{% if let Some(var) = var %}
{{ var }}
{% endif %}
The following code:
#[derive(Template)]
#[template(path = "base.html", block = "empty")]
struct Empty {}
Gives an error:
no field `var` on type `&Empty`
Due to the (empty) match statement generated by the derive macro, even though the field var
is not necessary to render just the empty
block.