dioxus
dioxus copied to clipboard
Braced expressions followed by a method don't parse
Problem
The rsx macro doesn't handle braced expressions correctly
Reproduction
This code fails to compile
// [dependencies]
// dioxus = { version = "0.6" }
use dioxus::prelude::*;
fn main() {
rsx! {
div {
width: {"100%"}.to_string()
}
};
}
Expected behavior
The code should compile and run
Environment:
- Dioxus version: 0.6, and main
- Rust version: nightly
- OS info: macOS
- App platform: all
Changing it to:
// [dependencies]
// dioxus = { version = "0.6" }
use dioxus::prelude::*;
fn main() {
rsx! {
div {
width: {{"100%"}.to_string()}
}
};
}
makes the code compile but gives an "unnecessary braces" warning. This could be a workaround for people facing this issue.
Fixed by #4035