macros: Remove use requirement on minidom::Element.

Emmanuel Gil Peyrot created

Change summary

src/attention.rs       |  3 -
src/chatstates.rs      |  3 -
src/component.rs       |  2 
src/delay.rs           |  2 
src/eme.rs             |  3 -
src/hashes.rs          |  3 +
src/ibb.rs             |  3 -
src/idle.rs            |  2 
src/jingle_ibb.rs      |  3 -
src/macros.rs          | 70 ++++++++++++++++++++++----------------------
src/media_element.rs   |  3 -
src/message_correct.rs |  3 -
src/mood.rs            |  3 -
src/ping.rs            |  3 -
src/receipts.rs        |  3 -
src/roster.rs          |  2 
src/sasl.rs            |  3 -
src/stanza_id.rs       |  2 
src/stream.rs          |  2 
src/websocket.rs       |  2 
20 files changed, 55 insertions(+), 65 deletions(-)

Detailed changes

src/attention.rs 🔗

@@ -4,8 +4,6 @@
 // License, v. 2.0. If a copy of the MPL was not distributed with this
 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-use minidom::Element;
-
 use error::Error;
 
 use ns;
@@ -16,6 +14,7 @@ generate_empty_element!(Attention, "attention", ns::ATTENTION);
 mod tests {
     use super::*;
     use try_from::TryFrom;
+    use minidom::Element;
 
     #[test]
     fn test_simple() {

src/chatstates.rs 🔗

@@ -6,8 +6,6 @@
 
 #![deny(missing_docs)]
 
-use minidom::Element;
-
 use error::Error;
 
 use ns;
@@ -37,6 +35,7 @@ generate_element_enum!(
 mod tests {
     use super::*;
     use try_from::TryFrom;
+    use minidom::Element;
 
     #[test]
     fn test_simple() {

src/component.rs 🔗

@@ -4,7 +4,6 @@
 // License, v. 2.0. If a copy of the MPL was not distributed with this
 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-use minidom::Element;
 use error::Error;
 use helpers::PlainText;
 use ns;
@@ -37,6 +36,7 @@ impl Handshake {
 mod tests {
     use super::*;
     use try_from::TryFrom;
+    use minidom::Element;
 
     #[test]
     fn test_simple() {

src/delay.rs 🔗

@@ -4,7 +4,6 @@
 // License, v. 2.0. If a copy of the MPL was not distributed with this
 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-use minidom::Element;
 use date::DateTime;
 
 use error::Error;
@@ -25,6 +24,7 @@ generate_element_with_text!(Delay, "delay", ns::DELAY,
 mod tests {
     use super::*;
     use try_from::TryFrom;
+    use minidom::Element;
     use std::str::FromStr;
 
     #[test]

src/eme.rs 🔗

@@ -4,8 +4,6 @@
 // License, v. 2.0. If a copy of the MPL was not distributed with this
 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-use minidom::Element;
-
 use error::Error;
 
 use ns;
@@ -25,6 +23,7 @@ ExplicitMessageEncryption, "encryption", ns::EME, [
 mod tests {
     use super::*;
     use try_from::TryFrom;
+    use minidom::Element;
 
     #[test]
     fn test_simple() {

src/hashes.rs 🔗

@@ -6,7 +6,7 @@
 
 use std::str::FromStr;
 
-use minidom::{Element, IntoAttributeValue};
+use minidom::IntoAttributeValue;
 
 use error::Error;
 
@@ -93,6 +93,7 @@ impl Hash {
 mod tests {
     use super::*;
     use try_from::TryFrom;
+    use minidom::Element;
 
     #[test]
     fn test_simple() {

src/ibb.rs 🔗

@@ -4,8 +4,6 @@
 // License, v. 2.0. If a copy of the MPL was not distributed with this
 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-use minidom::Element;
-
 use error::Error;
 
 use ns;
@@ -38,6 +36,7 @@ generate_element_with_only_attributes!(Close, "close", ns::IBB, [
 mod tests {
     use super::*;
     use try_from::TryFrom;
+    use minidom::Element;
     use std::error::Error as StdError;
 
     #[test]

src/idle.rs 🔗

@@ -4,7 +4,6 @@
 // License, v. 2.0. If a copy of the MPL was not distributed with this
 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-use minidom::Element;
 use date::DateTime;
 
 use error::Error;
@@ -19,6 +18,7 @@ generate_element_with_only_attributes!(Idle, "idle", ns::IDLE, [
 mod tests {
     use super::*;
     use try_from::TryFrom;
+    use minidom::Element;
     use std::str::FromStr;
     use std::error::Error as StdError;
 

src/jingle_ibb.rs 🔗

@@ -4,8 +4,6 @@
 // License, v. 2.0. If a copy of the MPL was not distributed with this
 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-use minidom::Element;
-
 use error::Error;
 
 use ns;
@@ -24,6 +22,7 @@ generate_element_with_only_attributes!(Transport, "transport", ns::JINGLE_IBB, [
 mod tests {
     use super::*;
     use try_from::TryFrom;
+    use minidom::Element;
     use std::error::Error as StdError;
 
     #[test]

src/macros.rs 🔗

@@ -116,9 +116,9 @@ macro_rules! generate_element_enum {
             $enum
             ),+
         }
-        impl ::try_from::TryFrom<Element> for $elem {
+        impl ::try_from::TryFrom<::minidom::Element> for $elem {
             type Err = Error;
-            fn try_from(elem: Element) -> Result<$elem, Error> {
+            fn try_from(elem: ::minidom::Element) -> Result<$elem, Error> {
                 check_ns_only!(elem, $name, $ns);
                 check_no_children!(elem, $name);
                 check_no_attributes!(elem, $name);
@@ -128,9 +128,9 @@ macro_rules! generate_element_enum {
                 })
             }
         }
-        impl From<$elem> for Element {
-            fn from(elem: $elem) -> Element {
-                Element::builder(match elem {
+        impl From<$elem> for ::minidom::Element {
+            fn from(elem: $elem) -> ::minidom::Element {
+                ::minidom::Element::builder(match elem {
                     $($elem::$enum => $enum_name,)+
                 }).ns($ns)
                   .build()
@@ -152,9 +152,9 @@ macro_rules! generate_attribute_enum {
             $enum
             ),+
         }
-        impl ::try_from::TryFrom<Element> for $elem {
+        impl ::try_from::TryFrom<::minidom::Element> for $elem {
             type Err = Error;
-            fn try_from(elem: Element) -> Result<$elem, Error> {
+            fn try_from(elem: ::minidom::Element) -> Result<$elem, Error> {
                 check_ns_only!(elem, $name, $ns);
                 check_no_children!(elem, $name);
                 check_no_unknown_attributes!(elem, $name, [$attr]);
@@ -164,9 +164,9 @@ macro_rules! generate_attribute_enum {
                 })
             }
         }
-        impl From<$elem> for Element {
-            fn from(elem: $elem) -> Element {
-                Element::builder($name)
+        impl From<$elem> for ::minidom::Element {
+            fn from(elem: $elem) -> ::minidom::Element {
+                ::minidom::Element::builder($name)
                         .ns($ns)
                         .attr($attr, match elem {
                              $($elem::$enum => $enum_name,)+
@@ -231,10 +231,10 @@ macro_rules! generate_empty_element {
         #[derive(Debug, Clone)]
         pub struct $elem;
 
-        impl ::try_from::TryFrom<Element> for $elem {
+        impl ::try_from::TryFrom<::minidom::Element> for $elem {
             type Err = Error;
 
-            fn try_from(elem: Element) -> Result<$elem, Error> {
+            fn try_from(elem: ::minidom::Element) -> Result<$elem, Error> {
                 check_self!(elem, $name, $ns);
                 check_no_children!(elem, $name);
                 check_no_attributes!(elem, $name);
@@ -242,9 +242,9 @@ macro_rules! generate_empty_element {
             }
         }
 
-        impl From<$elem> for Element {
-            fn from(_: $elem) -> Element {
-                Element::builder($name)
+        impl From<$elem> for ::minidom::Element {
+            fn from(_: $elem) -> ::minidom::Element {
+                ::minidom::Element::builder($name)
                         .ns($ns)
                         .build()
             }
@@ -266,10 +266,10 @@ macro_rules! generate_element_with_only_attributes {
             )*
         }
 
-        impl ::try_from::TryFrom<Element> for $elem {
+        impl ::try_from::TryFrom<::minidom::Element> for $elem {
             type Err = Error;
 
-            fn try_from(elem: Element) -> Result<$elem, Error> {
+            fn try_from(elem: ::minidom::Element) -> Result<$elem, Error> {
                 check_self!(elem, $name, $ns);
                 check_no_children!(elem, $name);
                 check_no_unknown_attributes!(elem, $name, [$($attr_name),*]);
@@ -281,9 +281,9 @@ macro_rules! generate_element_with_only_attributes {
             }
         }
 
-        impl From<$elem> for Element {
-            fn from(elem: $elem) -> Element {
-                Element::builder($name)
+        impl From<$elem> for ::minidom::Element {
+            fn from(elem: $elem) -> ::minidom::Element {
+                ::minidom::Element::builder($name)
                         .ns($ns)
                         $(
                         .attr($attr_name, elem.$attr)
@@ -324,9 +324,9 @@ macro_rules! generate_elem_id {
                 Ok($elem(String::from(s)))
             }
         }
-        impl ::try_from::TryFrom<Element> for $elem {
+        impl ::try_from::TryFrom<::minidom::Element> for $elem {
             type Err = Error;
-            fn try_from(elem: Element) -> Result<$elem, Error> {
+            fn try_from(elem: ::minidom::Element) -> Result<$elem, Error> {
                 check_self!(elem, $name, $ns);
                 check_no_children!(elem, $name);
                 check_no_attributes!(elem, $name);
@@ -334,9 +334,9 @@ macro_rules! generate_elem_id {
                 Ok($elem(elem.text()))
             }
         }
-        impl From<$elem> for Element {
-            fn from(elem: $elem) -> Element {
-                Element::builder($name)
+        impl From<$elem> for ::minidom::Element {
+            fn from(elem: $elem) -> ::minidom::Element {
+                ::minidom::Element::builder($name)
                         .ns($ns)
                         .append(elem.0)
                         .build()
@@ -360,10 +360,10 @@ macro_rules! generate_element_with_text {
             pub $text_ident: $text_type,
         }
 
-        impl ::try_from::TryFrom<Element> for $elem {
+        impl ::try_from::TryFrom<::minidom::Element> for $elem {
             type Err = Error;
 
-            fn try_from(elem: Element) -> Result<$elem, Error> {
+            fn try_from(elem: ::minidom::Element) -> Result<$elem, Error> {
                 check_self!(elem, $name, $ns);
                 check_no_children!(elem, $name);
                 check_no_unknown_attributes!(elem, $name, [$($attr_name),*]);
@@ -376,9 +376,9 @@ macro_rules! generate_element_with_text {
             }
         }
 
-        impl From<$elem> for Element {
-            fn from(elem: $elem) -> Element {
-                Element::builder($name)
+        impl From<$elem> for ::minidom::Element {
+            fn from(elem: $elem) -> ::minidom::Element {
+                ::minidom::Element::builder($name)
                         .ns($ns)
                         $(
                         .attr($attr_name, elem.$attr)
@@ -405,10 +405,10 @@ macro_rules! generate_element_with_children {
             )*
         }
 
-        impl ::try_from::TryFrom<Element> for $elem {
+        impl ::try_from::TryFrom<::minidom::Element> for $elem {
             type Err = Error;
 
-            fn try_from(elem: Element) -> Result<$elem, Error> {
+            fn try_from(elem: ::minidom::Element) -> Result<$elem, Error> {
                 check_self!(elem, $name, $ns);
                 check_no_unknown_attributes!(elem, $name, [$($attr_name),*]);
                 let mut parsed_children = vec!();
@@ -433,9 +433,9 @@ macro_rules! generate_element_with_children {
             }
         }
 
-        impl From<$elem> for Element {
-            fn from(elem: $elem) -> Element {
-                Element::builder($name)
+        impl From<$elem> for ::minidom::Element {
+            fn from(elem: $elem) -> ::minidom::Element {
+                ::minidom::Element::builder($name)
                         .ns($ns)
                         $(
                         .attr($attr_name, elem.$attr)

src/media_element.rs 🔗

@@ -4,8 +4,6 @@
 // License, v. 2.0. If a copy of the MPL was not distributed with this
 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-use minidom::Element;
-
 use error::Error;
 
 use ns;
@@ -32,6 +30,7 @@ generate_element_with_children!(MediaElement, "media", ns::MEDIA_ELEMENT,
 mod tests {
     use super::*;
     use try_from::TryFrom;
+    use minidom::Element;
     use data_forms::DataForm;
     use std::error::Error as StdError;
 

src/message_correct.rs 🔗

@@ -4,8 +4,6 @@
 // License, v. 2.0. If a copy of the MPL was not distributed with this
 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-use minidom::Element;
-
 use error::Error;
 
 use ns;
@@ -18,6 +16,7 @@ generate_element_with_only_attributes!(Replace, "replace", ns::MESSAGE_CORRECT,
 mod tests {
     use super::*;
     use try_from::TryFrom;
+    use minidom::Element;
 
     #[test]
     fn test_simple() {

src/mood.rs 🔗

@@ -6,8 +6,6 @@
 
 #![deny(missing_docs)]
 
-use minidom::Element;
-
 use error::Error;
 
 use ns;
@@ -273,6 +271,7 @@ generate_element_enum!(
 mod tests {
     use super::*;
     use try_from::TryFrom;
+    use minidom::Element;
 
     #[test]
     fn test_simple() {

src/ping.rs 🔗

@@ -5,8 +5,6 @@
 // License, v. 2.0. If a copy of the MPL was not distributed with this
 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-use minidom::Element;
-
 use error::Error;
 
 use ns;
@@ -17,6 +15,7 @@ generate_empty_element!(Ping, "ping", ns::PING);
 mod tests {
     use super::*;
     use try_from::TryFrom;
+    use minidom::Element;
 
     #[test]
     fn test_simple() {

src/receipts.rs 🔗

@@ -4,8 +4,6 @@
 // License, v. 2.0. If a copy of the MPL was not distributed with this
 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-use minidom::Element;
-
 use error::Error;
 
 use ns;
@@ -20,6 +18,7 @@ generate_element_with_only_attributes!(Received, "received", ns::RECEIPTS, [
 mod tests {
     use super::*;
     use try_from::TryFrom;
+    use minidom::Element;
 
     #[test]
     fn test_simple() {

src/roster.rs 🔗

@@ -4,7 +4,6 @@
 // License, v. 2.0. If a copy of the MPL was not distributed with this
 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-use minidom::Element;
 use jid::Jid;
 
 use error::Error;
@@ -62,6 +61,7 @@ generate_element_with_children!(
 mod tests {
     use super::*;
     use try_from::TryFrom;
+    use minidom::Element;
     use std::str::FromStr;
     use compare_elements::NamespaceAwareCompare;
 

src/sasl.rs 🔗

@@ -4,8 +4,6 @@
 // License, v. 2.0. If a copy of the MPL was not distributed with this
 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-use minidom::Element;
-
 use error::Error;
 
 use ns;
@@ -40,6 +38,7 @@ generate_element_with_text!(Success, "success", ns::SASL,
 mod tests {
     use super::*;
     use try_from::TryFrom;
+    use minidom::Element;
 
     #[test]
     fn test_simple() {

src/stanza_id.rs 🔗

@@ -4,7 +4,6 @@
 // License, v. 2.0. If a copy of the MPL was not distributed with this
 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-use minidom::Element;
 use jid::Jid;
 
 use error::Error;
@@ -24,6 +23,7 @@ generate_element_with_only_attributes!(OriginId, "origin-id", ns::SID, [
 mod tests {
     use super::*;
     use try_from::TryFrom;
+    use minidom::Element;
     use std::str::FromStr;
 
     #[test]

src/stream.rs 🔗

@@ -4,7 +4,6 @@
 // License, v. 2.0. If a copy of the MPL was not distributed with this
 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-use minidom::Element;
 use jid::Jid;
 use error::Error;
 use ns;
@@ -55,6 +54,7 @@ impl Stream {
 mod tests {
     use super::*;
     use try_from::TryFrom;
+    use minidom::Element;
 
     #[test]
     fn test_simple() {

src/websocket.rs 🔗

@@ -4,7 +4,6 @@
 // License, v. 2.0. If a copy of the MPL was not distributed with this
 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-use minidom::Element;
 use jid::Jid;
 use error::Error;
 use ns;
@@ -55,6 +54,7 @@ impl Open {
 mod tests {
     use super::*;
     use try_from::TryFrom;
+    use minidom::Element;
 
     #[test]
     fn test_simple() {