xmpp-parsers: Prefer Bare/FromJid::new to FromStr::from_str.

This commit is contained in:
Emmanuel Gil Peyrot 2020-12-10 20:45:30 +01:00
commit f34897b198
10 changed files with 30 additions and 49 deletions

View file

@ -244,7 +244,7 @@ impl From<PubSubEvent> for Element {
#[cfg(test)]
mod tests {
use super::*;
use std::str::FromStr;
use jid::BareJid;
#[test]
fn missing_items() {
@ -269,8 +269,8 @@ mod tests {
assert_eq!(node, NodeName(String::from("coucou")));
assert_eq!(items[0].id, Some(ItemId(String::from("test"))));
assert_eq!(
items[0].publisher,
Some(Jid::from_str("test@coucou").unwrap())
items[0].publisher.clone().unwrap(),
BareJid::new("test", "coucou")
);
assert_eq!(items[0].payload, None);
}
@ -401,7 +401,7 @@ mod tests {
)))
);
assert_eq!(subscription, Some(Subscription::Subscribed));
assert_eq!(jid, Some(Jid::from_str("francisco@denmark.lit").unwrap()));
assert_eq!(jid.unwrap(), BareJid::new("francisco", "denmark.lit"));
assert_eq!(expiry, Some("2006-02-28T23:59:59Z".parse().unwrap()));
}
_ => panic!(),