Closed GuillaumeGomez closed 2 months ago
The change looks good to me. :+1:
Currently we test on stable and beta. Maybe we could add nightly, too, and enable the tests only on nightly?
After thinking some more about it, I don't think checking with nightly will be what we want: we want to check the generated code here, not that it works on nightly.
I'll open an issue to discuss about how to test generated content because I think it's a problem that we need to solve somehow.
Maybe the generator should desugar let chains into something that works on stable? It's okay if the generated code isn't the prettiest.
I don't think we should implement our own condition lexer, we should just rely on the rust compiler to handle this part for us. For example, it becomes particularly tricky in cases like:
if let Some(x) = y || z == "x" && whatever
It requires to generate else if z == "x"
and in both if
branches to have also whatever
.
I opened https://github.com/djc/askama/issues/1038 about this.
(Would prefer if you don't merge non-trivial PRs without my approval.)
Sorry, noted for future contributions.
Fixes #1033.
We cannot test the generated code since the if-let chain feature is still unstable. So I thought about two possibilities to still test this:
Here are the cases to be checked:
Where
s
isOption<String>
.