Skip to content

Leptosfmt removes neccesary curly brackets #138

@nikessel

Description

@nikessel

I have this code inside a view:

                            view! {
                                <option value={Into::<&'static str>::into(std)}>{std.pretty()}</option>
                            }

Which compiles just fine. But if I run leptosfmt, it is formatted to this:

                            view! {
                                <option value=Into::<
                                    &'static str,
                                >::into(std)>{std.pretty()}</option>
                            }

Where the curly brackets around the Into call are removed. This leads to a parser error from the view macro:

error: failed to parse expression: unexpected end of input, expected one of: for, parentheses, fn, unsafe, extern, identifier, ::, <, dyn, square brackets, *, &, !, impl, _, lifetime
--> src/components/slides/report/one.rs:60:51
|
60 | ... <option value=Into::<
| ^^^^

Since the end of the Into call generic is interpreted as the end of the <option tag

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions