fix: use annotation method from rust/58052 to fix closure lifetimes

This commit is contained in:
Jonathan Kelley committed 2021-10-30 18:23:28 -04:00
1 parent 9ee2bfb010
commit 27d891934a
15 files changed
+333 -180

No files matched your search

+6 -6
View File
@@ -13,14 +13,14 @@ fn test_borrowed_state() {
fn Parent((cx, _): Scope<()>) -> Element {
let value = cx.use_hook(|_| String::new(), |f| &*f, |_| {});
rsx! {
cx.render(rsx! {
div {
Child { name: value }
Child { name: value }
Child { name: value }
Child { name: value }
}
}
})
}
#[derive(Props)]
@@ -29,12 +29,12 @@ struct ChildProps<'a> {
}
fn Child<'a>((cx, props): Scope<'a, ChildProps>) -> Element<'a> {
rsx! {
cx.render(rsx! {
div {
h1 { "it's nested" }
Child2 { name: props.name }
}
}
})
}
#[derive(Props)]
@@ -43,7 +43,7 @@ struct Grandchild<'a> {
}
fn Child2<'a>((cx, props): Scope<'a, Grandchild>) -> Element<'a> {
rsx! {
cx.render(rsx! {
div { "Hello {props.name}!" }
}
})
}
+8 -8
View File
@@ -14,23 +14,23 @@ mod test_logging;
#[test]
fn please_work() {
static App: FC<()> = |(cx, props)| {
rsx! {
cx.render(rsx! {
div {
hidden: "true"
"hello"
div { "hello" }
Child {}
Child {}
Child {}
// Child {}
// Child {}
// Child {}
}
div { "hello" }
}
// div { "hello" }
})
};
static Child: FC<()> = |(cx, props)| {
rsx! {
cx.render(rsx! {
div { "child" }
}
})
};
let mut dom = VirtualDom::new(App);