diff --git a/leptos_dom/src/macro_helpers/into_attribute.rs b/leptos_dom/src/macro_helpers/into_attribute.rs index 18a8fa7c7e..18dc834291 100644 --- a/leptos_dom/src/macro_helpers/into_attribute.rs +++ b/leptos_dom/src/macro_helpers/into_attribute.rs @@ -138,15 +138,6 @@ macro_rules! impl_into_attr_boxed { }; } -impl IntoAttribute for Option { - #[inline(always)] - fn into_attribute(self) -> Attribute { - self.unwrap_or(Attribute::Option(None)) - } - - impl_into_attr_boxed! {} -} - impl IntoAttribute for String { #[inline(always)] fn into_attribute(self) -> Attribute { @@ -201,46 +192,10 @@ impl IntoAttribute for bool { impl_into_attr_boxed! {} } -impl IntoAttribute for Option { - #[inline(always)] - fn into_attribute(self) -> Attribute { - Attribute::Option(self.map(Oco::Owned)) - } - - impl_into_attr_boxed! {} -} - -impl IntoAttribute for Option<&'static str> { - #[inline(always)] - fn into_attribute(self) -> Attribute { - Attribute::Option(self.map(Oco::Borrowed)) - } - - impl_into_attr_boxed! {} -} - -impl IntoAttribute for Option> { +impl IntoAttribute for Option { #[inline(always)] fn into_attribute(self) -> Attribute { - Attribute::Option(self.map(Oco::Counted)) - } - - impl_into_attr_boxed! {} -} - -impl IntoAttribute for Option> { - #[inline(always)] - fn into_attribute(self) -> Attribute { - Attribute::Option(self.map(Oco::from)) - } - - impl_into_attr_boxed! {} -} - -impl IntoAttribute for Option> { - #[inline(always)] - fn into_attribute(self) -> Attribute { - Attribute::Option(self) + self.map_or(Attribute::Option(None), IntoAttribute::into_attribute) } impl_into_attr_boxed! {} @@ -310,17 +265,6 @@ macro_rules! attr_type { self.into_attribute() } } - - impl IntoAttribute for Option<$attr_type> { - fn into_attribute(self) -> Attribute { - Attribute::Option(self.map(|n| n.to_string().into())) - } - - #[inline] - fn into_attribute_boxed(self: Box) -> Attribute { - self.into_attribute() - } - } }; } @@ -341,24 +285,6 @@ macro_rules! attr_signal_type { }; } -macro_rules! attr_signal_type_optional { - ($signal_type:ty) => { - #[cfg(not(feature = "nightly"))] - impl IntoAttribute for $signal_type - where - T: Clone, - Option: IntoAttribute, - { - fn into_attribute(self) -> Attribute { - let modified_fn = Rc::new(move || self.get().into_attribute()); - Attribute::Fn(modified_fn) - } - - impl_into_attr_boxed! {} - } - }; -} - attr_type!(&String); attr_type!(usize); attr_type!(u8); @@ -381,7 +307,7 @@ attr_signal_type!(RwSignal); attr_signal_type!(Memo); attr_signal_type!(Signal); attr_signal_type!(MaybeSignal); -attr_signal_type_optional!(MaybeProp); +attr_signal_type!(MaybeProp); #[cfg(all(target_arch = "wasm32", feature = "web"))] #[doc(hidden)] diff --git a/leptos_dom/src/nonce.rs b/leptos_dom/src/nonce.rs index 1969b68de0..68b7c0dbe6 100644 --- a/leptos_dom/src/nonce.rs +++ b/leptos_dom/src/nonce.rs @@ -69,16 +69,6 @@ impl IntoAttribute for Nonce { } } -impl IntoAttribute for Option { - fn into_attribute(self) -> Attribute { - Attribute::Option(self.map(|n| n.0.into())) - } - - fn into_attribute_boxed(self: Box) -> Attribute { - Attribute::Option(self.map(|n| n.0.into())) - } -} - /// Accesses the nonce that has been generated during the current /// server response. This can be added to inline `