diff --git a/xmpp-parsers/src/bob.rs b/xmpp-parsers/src/bob.rs index 39cf738d..e6756440 100644 --- a/xmpp-parsers/src/bob.rs +++ b/xmpp-parsers/src/bob.rs @@ -90,7 +90,6 @@ mod tests { use super::*; use crate::Element; use std::convert::TryFrom; - use std::error::Error as StdError; #[cfg(target_pointer_width = "32")] #[test] @@ -165,7 +164,7 @@ mod tests { Error::ParseIntError(error) => error, _ => panic!(), }; - assert_eq!(message.description(), "invalid digit found in string"); + assert_eq!(message.to_string(), "invalid digit found in string"); } #[test] diff --git a/xmpp-parsers/src/date.rs b/xmpp-parsers/src/date.rs index bfcf4e16..2edf1e21 100644 --- a/xmpp-parsers/src/date.rs +++ b/xmpp-parsers/src/date.rs @@ -56,7 +56,6 @@ impl Into for DateTime { mod tests { use super::*; use chrono::{Datelike, Timelike}; - use std::error::Error as StdError; // DateTime’s size doesn’t depend on the architecture. #[test] @@ -85,7 +84,7 @@ mod tests { Error::ChronoParseError(string) => string, _ => panic!(), }; - assert_eq!(message.description(), "input is out of range"); + assert_eq!(message.to_string(), "input is out of range"); // Timezone ≥24:00 aren’t allowed. let error = DateTime::from_str("2017-05-27T12:11:02+25:00").unwrap_err(); @@ -93,7 +92,7 @@ mod tests { Error::ChronoParseError(string) => string, _ => panic!(), }; - assert_eq!(message.description(), "input is out of range"); + assert_eq!(message.to_string(), "input is out of range"); // Timezone without the : separator aren’t allowed. let error = DateTime::from_str("2017-05-27T12:11:02+0100").unwrap_err(); @@ -101,7 +100,7 @@ mod tests { Error::ChronoParseError(string) => string, _ => panic!(), }; - assert_eq!(message.description(), "input contains invalid characters"); + assert_eq!(message.to_string(), "input contains invalid characters"); // No seconds, error message could be improved. let error = DateTime::from_str("2017-05-27T12:11+01:00").unwrap_err(); @@ -109,7 +108,7 @@ mod tests { Error::ChronoParseError(string) => string, _ => panic!(), }; - assert_eq!(message.description(), "input contains invalid characters"); + assert_eq!(message.to_string(), "input contains invalid characters"); // TODO: maybe we’ll want to support this one, as per XEP-0082 §4. let error = DateTime::from_str("20170527T12:11:02+01:00").unwrap_err(); @@ -117,7 +116,7 @@ mod tests { Error::ChronoParseError(string) => string, _ => panic!(), }; - assert_eq!(message.description(), "input contains invalid characters"); + assert_eq!(message.to_string(), "input contains invalid characters"); // No timezone. let error = DateTime::from_str("2017-05-27T12:11:02").unwrap_err(); @@ -125,7 +124,7 @@ mod tests { Error::ChronoParseError(string) => string, _ => panic!(), }; - assert_eq!(message.description(), "premature end of input"); + assert_eq!(message.to_string(), "premature end of input"); } #[test] diff --git a/xmpp-parsers/src/ibb.rs b/xmpp-parsers/src/ibb.rs index 17d26764..3e4ab575 100644 --- a/xmpp-parsers/src/ibb.rs +++ b/xmpp-parsers/src/ibb.rs @@ -75,7 +75,6 @@ mod tests { use crate::util::error::Error; use crate::Element; use std::convert::TryFrom; - use std::error::Error as StdError; #[cfg(target_pointer_width = "32")] #[test] @@ -146,7 +145,7 @@ mod tests { Error::ParseIntError(error) => error, _ => panic!(), }; - assert_eq!(message.description(), "invalid digit found in string"); + assert_eq!(message.to_string(), "invalid digit found in string"); let elem: Element = "" .parse() diff --git a/xmpp-parsers/src/idle.rs b/xmpp-parsers/src/idle.rs index e06de9a5..a575b321 100644 --- a/xmpp-parsers/src/idle.rs +++ b/xmpp-parsers/src/idle.rs @@ -24,7 +24,6 @@ mod tests { use crate::util::error::Error; use crate::Element; use std::convert::TryFrom; - use std::error::Error as StdError; use std::str::FromStr; #[test] @@ -75,7 +74,7 @@ mod tests { Error::ChronoParseError(string) => string, _ => panic!(), }; - assert_eq!(message.description(), "input is out of range"); + assert_eq!(message.to_string(), "input is out of range"); // Timezone ≥24:00 aren’t allowed. let elem: Element = "" @@ -86,7 +85,7 @@ mod tests { Error::ChronoParseError(string) => string, _ => panic!(), }; - assert_eq!(message.description(), "input is out of range"); + assert_eq!(message.to_string(), "input is out of range"); // Timezone without the : separator aren’t allowed. let elem: Element = "" @@ -97,7 +96,7 @@ mod tests { Error::ChronoParseError(string) => string, _ => panic!(), }; - assert_eq!(message.description(), "input contains invalid characters"); + assert_eq!(message.to_string(), "input contains invalid characters"); // No seconds, error message could be improved. let elem: Element = "" @@ -108,7 +107,7 @@ mod tests { Error::ChronoParseError(string) => string, _ => panic!(), }; - assert_eq!(message.description(), "input contains invalid characters"); + assert_eq!(message.to_string(), "input contains invalid characters"); // TODO: maybe we’ll want to support this one, as per XEP-0082 §4. let elem: Element = "" @@ -119,7 +118,7 @@ mod tests { Error::ChronoParseError(string) => string, _ => panic!(), }; - assert_eq!(message.description(), "input contains invalid characters"); + assert_eq!(message.to_string(), "input contains invalid characters"); // No timezone. let elem: Element = "" @@ -130,7 +129,7 @@ mod tests { Error::ChronoParseError(string) => string, _ => panic!(), }; - assert_eq!(message.description(), "premature end of input"); + assert_eq!(message.to_string(), "premature end of input"); } #[test] diff --git a/xmpp-parsers/src/jingle_ibb.rs b/xmpp-parsers/src/jingle_ibb.rs index d980b5e3..3018842e 100644 --- a/xmpp-parsers/src/jingle_ibb.rs +++ b/xmpp-parsers/src/jingle_ibb.rs @@ -27,7 +27,6 @@ mod tests { use crate::util::error::Error; use crate::Element; use std::convert::TryFrom; - use std::error::Error as StdError; #[cfg(target_pointer_width = "32")] #[test] @@ -75,7 +74,7 @@ mod tests { _ => panic!(), }; assert_eq!( - message.description(), + message.to_string(), "number too large to fit in target type" ); @@ -87,7 +86,7 @@ mod tests { Error::ParseIntError(error) => error, _ => panic!(), }; - assert_eq!(message.description(), "invalid digit found in string"); + assert_eq!(message.to_string(), "invalid digit found in string"); let elem: Element = "" diff --git a/xmpp-parsers/src/mam.rs b/xmpp-parsers/src/mam.rs index d1decdd8..0c6ac536 100644 --- a/xmpp-parsers/src/mam.rs +++ b/xmpp-parsers/src/mam.rs @@ -193,7 +193,6 @@ impl From for Element { #[cfg(test)] mod tests { use super::*; - use crate::data_forms::{DataFormType, Field, FieldType}; use std::str::FromStr; #[cfg(target_pointer_width = "32")] diff --git a/xmpp-parsers/src/media_element.rs b/xmpp-parsers/src/media_element.rs index 3ac3f6a8..e1d93383 100644 --- a/xmpp-parsers/src/media_element.rs +++ b/xmpp-parsers/src/media_element.rs @@ -49,7 +49,6 @@ mod tests { use crate::util::error::Error; use crate::Element; use std::convert::TryFrom; - use std::error::Error as StdError; #[cfg(target_pointer_width = "32")] #[test] @@ -103,10 +102,7 @@ mod tests { Error::ParseIntError(error) => error, _ => panic!(), }; - assert_eq!( - error.description(), - "cannot parse integer from empty string" - ); + assert_eq!(error.to_string(), "cannot parse integer from empty string"); let elem: Element = "" .parse() @@ -116,7 +112,7 @@ mod tests { Error::ParseIntError(error) => error, _ => panic!(), }; - assert_eq!(error.description(), "invalid digit found in string"); + assert_eq!(error.to_string(), "invalid digit found in string"); let elem: Element = "" .parse() @@ -126,10 +122,7 @@ mod tests { Error::ParseIntError(error) => error, _ => panic!(), }; - assert_eq!( - error.description(), - "cannot parse integer from empty string" - ); + assert_eq!(error.to_string(), "cannot parse integer from empty string"); let elem: Element = "" .parse() @@ -139,7 +132,7 @@ mod tests { Error::ParseIntError(error) => error, _ => panic!(), }; - assert_eq!(error.description(), "invalid digit found in string"); + assert_eq!(error.to_string(), "invalid digit found in string"); } #[test] diff --git a/xmpp-parsers/src/muc/user.rs b/xmpp-parsers/src/muc/user.rs index 61f7f12c..0cfd8a5b 100644 --- a/xmpp-parsers/src/muc/user.rs +++ b/xmpp-parsers/src/muc/user.rs @@ -236,7 +236,6 @@ generate_element!( #[cfg(test)] mod tests { use super::*; - use std::error::Error as StdError; #[test] fn test_simple() { @@ -397,7 +396,7 @@ mod tests { Error::ParseIntError(error) => error, _ => panic!(), }; - assert_eq!(error.description(), "invalid digit found in string"); + assert_eq!(error.to_string(), "invalid digit found in string"); } #[test]