unwrap instead of using unreachable
@@ -182,7 +182,7 @@ impl<'a> DynamicContext<'a> {
let static_attrs = el.attributes.iter().map(|attr| match &attr.attr {
ElementAttr::AttrText { name, value } if value.is_static() => {
- if let Some(value) = value.to_static() {
+ let value = value.to_static().unwrap();
quote! {
::dioxus::core::TemplateAttribute::Static {
name: dioxus_elements::#el_name::#name.0,
@@ -193,13 +193,10 @@ impl<'a> DynamicContext<'a> {
// volatile: dioxus_elements::#el_name::#name.2,
}
}
- } else {
- unreachable!()
- }
}
ElementAttr::CustomAttrText { name, value } if value.is_static() => {
- if let Some(value) = value.to_static() {
+ let value = value.to_static().unwrap();
quote! {
::dioxus::core::TemplateAttribute::Static {
name: #name,
@@ -210,9 +207,6 @@ impl<'a> DynamicContext<'a> {
// volatile: dioxus_elements::#el_name::#name.2,
}
}
- } else {
- unreachable!()
- }
}
ElementAttr::AttrExpression { .. }
@@ -250,11 +244,8 @@ impl<'a> DynamicContext<'a> {
}
BodyNode::Text(text) if text.is_static() => {
- if let Some(text) = text.to_static() {
+ let text = text.to_static().unwrap();
quote! { ::dioxus::core::TemplateNode::Text{ text: #text } }
- } else {
- unreachable!()
- }
}
BodyNode::RawExpr(_)
