Update to jid-rs 0.2.3, which implements IntoAttributeValue on Jid.

Emmanuel Gil Peyrot created

Change summary

Cargo.toml          | 5 ++++-
src/delay.rs        | 2 +-
src/disco.rs        | 2 +-
src/iq.rs           | 4 ++--
src/jingle.rs       | 4 ++--
src/message.rs      | 4 ++--
src/muc/user.rs     | 7 ++-----
src/presence.rs     | 4 ++--
src/pubsub/event.rs | 4 ++--
src/roster.rs       | 2 +-
src/stanza_error.rs | 2 +-
src/stanza_id.rs    | 2 +-
12 files changed, 21 insertions(+), 21 deletions(-)

Detailed changes

Cargo.toml 🔗

@@ -14,7 +14,6 @@ license = "MPL-2.0"
 
 [dependencies]
 minidom = "0.4.4"
-jid = "0.2.0"
 base64 = "0.6.0"
 digest = "0.6.0"
 sha-1 = "0.4.0"
@@ -23,3 +22,7 @@ sha3 = "0.6.0"
 blake2 = "0.6.1"
 chrono = "0.4.0"
 try_from = "0.2.2"
+
+[dependencies.jid]
+version = "0.2.3"
+features = ["minidom"]

src/delay.rs 🔗

@@ -49,7 +49,7 @@ impl From<Delay> for Element {
     fn from(delay: Delay) -> Element {
         Element::builder("delay")
                 .ns(ns::DELAY)
-                .attr("from", delay.from.map(String::from))
+                .attr("from", delay.from)
                 .attr("stamp", delay.stamp.to_rfc3339())
                 .append(delay.data)
                 .build()

src/disco.rs 🔗

@@ -307,7 +307,7 @@ impl From<Item> for Element {
     fn from(item: Item) -> Element {
         Element::builder("item")
                 .ns(ns::DISCO_ITEMS)
-                .attr("jid", String::from(item.jid))
+                .attr("jid", item.jid)
                 .attr("node", item.node)
                 .attr("name", item.name)
                 .build()

src/iq.rs 🔗

@@ -276,8 +276,8 @@ impl From<Iq> for Element {
     fn from(iq: Iq) -> Element {
         let mut stanza = Element::builder("iq")
                                  .ns(ns::JABBER_CLIENT)
-                                 .attr("from", iq.from.map(String::from))
-                                 .attr("to", iq.to.map(String::from))
+                                 .attr("from", iq.from)
+                                 .attr("to", iq.to)
                                  .attr("id", iq.id)
                                  .attr("type", &iq.payload)
                                  .build();

src/jingle.rs 🔗

@@ -298,8 +298,8 @@ impl From<Jingle> for Element {
         Element::builder("jingle")
                 .ns(ns::JINGLE)
                 .attr("action", jingle.action)
-                .attr("initiator", match jingle.initiator { Some(initiator) => Some(String::from(initiator)), None => None })
-                .attr("responder", match jingle.responder { Some(responder) => Some(String::from(responder)), None => None })
+                .attr("initiator", jingle.initiator)
+                .attr("responder", jingle.responder)
                 .attr("sid", jingle.sid)
                 .append(jingle.contents)
                 .append(jingle.reason)

src/message.rs 🔗

@@ -211,8 +211,8 @@ impl From<Message> for Element {
     fn from(message: Message) -> Element {
         Element::builder("message")
                 .ns(ns::JABBER_CLIENT)
-                .attr("from", message.from.map(String::from))
-                .attr("to", message.to.map(String::from))
+                .attr("from", message.from)
+                .attr("to", message.to)
                 .attr("id", message.id)
                 .attr("type", message.type_)
                 .append(message.subjects.into_iter()

src/muc/user.rs 🔗

@@ -186,7 +186,7 @@ impl From<Actor> for Element {
         let elem = Element::builder("actor").ns(ns::MUC_USER);
 
         (match actor {
-            Actor::Jid(jid) => elem.attr("jid", String::from(jid)),
+            Actor::Jid(jid) => elem.attr("jid", jid),
             Actor::Nick(nick) => elem.attr("nick", nick),
         }).build()
     }
@@ -330,10 +330,7 @@ impl From<Item> for Element {
         Element::builder("item")
                 .ns(ns::MUC_USER)
                 .attr("affiliation", item.affiliation)
-                .attr("jid", match item.jid {
-                    Some(jid) => Some(String::from(jid)),
-                    None => None,
-                })
+                .attr("jid", item.jid)
                 .attr("nick", item.nick)
                 .attr("role", item.role)
                 .append(item.actor)

src/presence.rs 🔗

@@ -317,8 +317,8 @@ impl From<Presence> for Element {
     fn from(presence: Presence) -> Element {
         Element::builder("presence")
                 .ns(ns::JABBER_CLIENT)
-                .attr("from", presence.from.map(String::from))
-                .attr("to", presence.to.map(String::from))
+                .attr("from", presence.from)
+                .attr("to", presence.to)
                 .attr("id", presence.id)
                 .attr("type", presence.type_)
                 .append(presence.show)

src/pubsub/event.rs 🔗

@@ -31,7 +31,7 @@ impl From<Item> for Element {
                 .ns(ns::PUBSUB_EVENT)
                 .attr("id", item.id)
                 .attr("node", item.node)
-                .attr("publisher", item.publisher.map(String::from))
+                .attr("publisher", item.publisher)
                 .append(item.payload)
                 .build()
     }
@@ -255,7 +255,7 @@ impl From<PubSubEvent> for Element {
                         .ns(ns::PUBSUB_EVENT)
                         .attr("node", node)
                         .attr("expiry", expiry.map(|expiry| expiry.to_rfc3339()))
-                        .attr("jid", jid.map(String::from))
+                        .attr("jid", jid)
                         .attr("subid", subid)
                         .attr("subscription", subscription)
                         .build()

src/roster.rs 🔗

@@ -74,7 +74,7 @@ impl From<Item> for Element {
     fn from(item: Item) -> Element {
         Element::builder("item")
                 .ns(ns::ROSTER)
-                .attr("jid", String::from(item.jid))
+                .attr("jid", item.jid)
                 .attr("name", item.name)
                 .attr("subscription", item.subscription)
                 .append(item.groups)

src/stanza_error.rs 🔗

@@ -177,7 +177,7 @@ impl From<StanzaError> for Element {
         let mut root = Element::builder("error")
                                .ns(ns::JABBER_CLIENT)
                                .attr("type", err.type_)
-                               .attr("by", err.by.map(String::from))
+                               .attr("by", err.by)
                                .append(err.defined_condition)
                                .build();
         for (lang, text) in err.texts {

src/stanza_id.rs 🔗

@@ -41,7 +41,7 @@ impl From<StanzaId> for Element {
         Element::builder("stanza-id")
                 .ns(ns::SID)
                 .attr("id", stanza_id.id)
-                .attr("by", String::from(stanza_id.by))
+                .attr("by", stanza_id.by)
                 .build()
     }
 }