DioxusLabs / dioxus

Fullstack GUI library for web, desktop, mobile, and more.
https://dioxuslabs.com
Apache License 2.0
19.33k stars 736 forks source link

bug: CLI `fmt` panics when destructuring in conditional rendering inside RSX #2203

Closed marc2332 closed 3 months ago

marc2332 commented 3 months ago

Problem

Error:

> dx fmt --file examples\counter.rs
thread 'main' panicked at C:\Users\runneradmin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\prettyplease-0.2.17\src\item.rs:572:23:
not implemented: Item::Verbatim `fn main () { let Some (b) = Some (1) }`
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Code:

fn app() -> Element {
    let mut x = Some(1);

    rsx!(
        if let Some(b) = x {
            div {  }
        }
    )
}

Expected behavior

Work

Environment: