Switch todo!() to unreachable!/unimplemented! where it matters
This commit is contained in:
27 files changed
+73
-180
No files matched your search
@@ -17,7 +17,7 @@ loop {
|
||||
}
|
||||
|
||||
# fn app() -> Element { None }
|
||||
# struct SomeRenderer; impl SomeRenderer { fn new() -> SomeRenderer { SomeRenderer; } async fn event() -> () { todo!() } }
|
||||
# struct SomeRenderer; impl SomeRenderer { fn new() -> SomeRenderer { SomeRenderer; } async fn event() -> () { unimplemented!() } }
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
@@ -150,8 +150,8 @@ impl<T: std::fmt::Debug> std::fmt::Debug for Event<T> {
|
||||
/// }
|
||||
///
|
||||
/// #[derive(Props)]
|
||||
/// struct MyProps<'a> {
|
||||
/// onclick: EventHandler<'a, MouseEvent>,
|
||||
/// struct MyProps {
|
||||
/// onclick: EventHandler<MouseEvent>,
|
||||
/// }
|
||||
///
|
||||
/// fn MyComponent(cx: MyProps) -> Element {
|
||||
|
||||
@@ -72,7 +72,7 @@ where
|
||||
{
|
||||
type Builder = P;
|
||||
fn builder() -> Self::Builder {
|
||||
todo!()
|
||||
unreachable!("Root props technically are never built")
|
||||
}
|
||||
fn memoize(&mut self, _other: &Self) -> bool {
|
||||
true
|
||||
|
||||
@@ -77,100 +77,3 @@ fn events_generate() {
|
||||
]
|
||||
)
|
||||
}
|
||||
|
||||
// #[test]
|
||||
// fn components_generate() {
|
||||
// fn app() -> Element {
|
||||
// let render_phase = use_hook(|| 0);
|
||||
// *render_phase += 1;
|
||||
|
||||
// match *render_phase {
|
||||
// 1 => rsx_without_templates!("Text0"),
|
||||
// 2 => rsx_without_templates!(div {}),
|
||||
// 3 => rsx_without_templates!("Text2"),
|
||||
// 4 => rsx_without_templates!(Child {}),
|
||||
// 5 => rsx_without_templates!({ None as Option<()> }),
|
||||
// 6 => rsx_without_templates!("text 3"),
|
||||
// 7 => rsx_without_templates!({ (0..2).map(|f| rsx_without_templates!("text {f}")) }),
|
||||
// 8 => rsx_without_templates!(Child {}),
|
||||
// _ => todo!(),
|
||||
// })
|
||||
// };
|
||||
|
||||
// fn Child() -> Element {
|
||||
// println!("Running child");
|
||||
// render_without_templates! {
|
||||
// h1 {}
|
||||
// })
|
||||
// }
|
||||
|
||||
// let mut dom = VirtualDom::new(app);
|
||||
// let edits = dom.rebuild_to_vec();
|
||||
// assert_eq!(
|
||||
// edits.edits,
|
||||
// [
|
||||
// CreateTextNode { root: Some(1), text: "Text0" },
|
||||
// AppendChildren { root: Some(0), children: vec![1] }
|
||||
// ]
|
||||
// );
|
||||
|
||||
// assert_eq!(
|
||||
// dom.hard_diff(ScopeId::ROOT).edits,
|
||||
// [
|
||||
// CreateElement { root: Some(2), tag: "div", children: 0 },
|
||||
// ReplaceWith { root: Some(1), nodes: vec![2] }
|
||||
// ]
|
||||
// );
|
||||
|
||||
// assert_eq!(
|
||||
// dom.hard_diff(ScopeId::ROOT).edits,
|
||||
// [
|
||||
// CreateTextNode { root: Some(1), text: "Text2" },
|
||||
// ReplaceWith { root: Some(2), nodes: vec![1] }
|
||||
// ]
|
||||
// );
|
||||
|
||||
// // child {}
|
||||
// assert_eq!(
|
||||
// dom.hard_diff(ScopeId::ROOT).edits,
|
||||
// [
|
||||
// CreateElement { root: Some(2), tag: "h1", children: 0 },
|
||||
// ReplaceWith { root: Some(1), nodes: vec![2] }
|
||||
// ]
|
||||
// );
|
||||
|
||||
// // placeholder
|
||||
// assert_eq!(
|
||||
// dom.hard_diff(ScopeId::ROOT).edits,
|
||||
// [
|
||||
// CreatePlaceholder { root: Some(1) },
|
||||
// ReplaceWith { root: Some(2), nodes: vec![1] }
|
||||
// ]
|
||||
// );
|
||||
|
||||
// assert_eq!(
|
||||
// dom.hard_diff(ScopeId::ROOT).edits,
|
||||
// [
|
||||
// CreateTextNode { root: Some(2), text: "text 3" },
|
||||
// ReplaceWith { root: Some(1), nodes: vec![2] }
|
||||
// ]
|
||||
// );
|
||||
|
||||
// assert_eq!(
|
||||
// dom.hard_diff(ScopeId::ROOT).edits,
|
||||
// [
|
||||
// CreateTextNode { text: "text 0", root: Some(1) },
|
||||
// CreateTextNode { text: "text 1", root: Some(3) },
|
||||
// ReplaceWith { root: Some(2), nodes: vec![1, 3] },
|
||||
// ]
|
||||
// );
|
||||
|
||||
// assert_eq!(
|
||||
// dom.hard_diff(ScopeId::ROOT).edits,
|
||||
// [
|
||||
// CreateElement { tag: "h1", root: Some(2), children: 0 },
|
||||
// ReplaceWith { root: Some(1), nodes: vec![2] },
|
||||
// Remove { root: Some(3) },
|
||||
// ]
|
||||
// );
|
||||
// }
|
||||
@@ -95,7 +95,7 @@ fn diffing_drops_old() {
|
||||
match generation() % 2 {
|
||||
0 => rsx!( ChildComp1 { name: "asdasd".to_string() }),
|
||||
1 => rsx!( ChildComp2 { name: "asdasd".to_string() }),
|
||||
_ => todo!()
|
||||
_ => unreachable!()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,14 +97,6 @@ fn memo_works_properly() {
|
||||
let mut dom = VirtualDom::new(app);
|
||||
|
||||
dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
// todo!()
|
||||
// dom.hard_diff(ScopeId::ROOT);
|
||||
// dom.hard_diff(ScopeId::ROOT);
|
||||
// dom.hard_diff(ScopeId::ROOT);
|
||||
// dom.hard_diff(ScopeId::ROOT);
|
||||
// dom.hard_diff(ScopeId::ROOT);
|
||||
// dom.hard_diff(ScopeId::ROOT);
|
||||
// dom.hard_diff(ScopeId::ROOT);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user