From 877d5c21dafe51446a8d026de3759634d42168be Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sun, 3 Nov 2019 18:49:11 +0100 Subject: [PATCH] minidom: Add a blanket impl for From> for Node. --- minidom-rs/src/node.rs | 8 +++++--- xmpp-parsers/src/util/macros.rs | 34 --------------------------------- 2 files changed, 5 insertions(+), 37 deletions(-) diff --git a/minidom-rs/src/node.rs b/minidom-rs/src/node.rs index ebce9063..4a6802e6 100644 --- a/minidom-rs/src/node.rs +++ b/minidom-rs/src/node.rs @@ -182,9 +182,11 @@ impl Node { } } -impl From for Node { - fn from(elm: Element) -> Node { - Node::Element(elm) +impl From for Node +where I: Into +{ + fn from(elm: I) -> Node { + Node::Element(elm.into()) } } diff --git a/xmpp-parsers/src/util/macros.rs b/xmpp-parsers/src/util/macros.rs index 13807e9d..f9d9611a 100644 --- a/xmpp-parsers/src/util/macros.rs +++ b/xmpp-parsers/src/util/macros.rs @@ -260,11 +260,6 @@ macro_rules! generate_element_enum { .build() } } - impl From<$elem> for ::minidom::Node { - fn from(elem: $elem) -> ::minidom::Node { - ::minidom::Node::Element(elem.into()) - } - } ); } @@ -303,11 +298,6 @@ macro_rules! generate_attribute_enum { .build() } } - impl From<$elem> for ::minidom::Node { - fn from(elem: $elem) -> ::minidom::Node { - ::minidom::Node::Element(elem.into()) - } - } ); } @@ -402,12 +392,6 @@ macro_rules! generate_empty_element { .build() } } - - impl From<$elem> for ::minidom::Node { - fn from(elem: $elem) -> ::minidom::Node { - ::minidom::Node::Element(elem.into()) - } - } ); } @@ -464,12 +448,6 @@ macro_rules! generate_elem_id { .build() } } - - impl From<$elem> for ::minidom::Node { - fn from(elem: $elem) -> ::minidom::Node { - ::minidom::Node::Element(elem.into()) - } - } ); } @@ -735,12 +713,6 @@ macro_rules! generate_element { builder.build() } } - - impl From<$elem> for ::minidom::Node { - fn from(elem: $elem) -> ::minidom::Node { - ::minidom::Node::Element(elem.into()) - } - } ); } @@ -786,12 +758,6 @@ macro_rules! impl_pubsub_item { } } - impl From<$item> for ::minidom::Node { - fn from(item: $item) -> ::minidom::Node { - ::minidom::Node::Element(item.into()) - } - } - impl ::std::ops::Deref for $item { type Target = crate::pubsub::Item;