Cannot use turbofish syntax in template
Closed this issue · 1 comments
OskarPersson commented
The following template code does not work:
<p>@books.into_iter().map(|b| b.title).collect::<Vec<String>>().join(", ")</p>
and results in the following error
--> C:\Users\oskar\git\books-rs\target\debug\build\books-rs-44f2c21020dbf42e\out\templates\template_books_html.rs:12:46
|
12 | books.into_iter().map(|b| b.title).collect.to_html(&mut _ructe_out_)?;
| ^^^^^^^ help: use parentheses to call the method: `collect()`
kaj commented
Yes, the turbofish makes the expression to complex to use without enclosing parenthesis. You can fix it by enclosing the entire expression in parenthesis:
<p>@(books.into_iter().map(|b| b.title).collect::<Vec<String>>().join(", "))</p>
The error message for this could be better (as could all error messages from the generated code), but I don't know how to do that.