ecaps2, forwarding, jingle_s5b, mam: Replace complex into expressions with .map(Element::from).

This commit is contained in:
Emmanuel Gil Peyrot 2017-07-20 20:52:25 +01:00
parent 487dbdc6de
commit cc563b46d2
4 changed files with 8 additions and 8 deletions

View file

@ -52,8 +52,8 @@ impl From<ECaps2> for Element {
Element::builder("c") Element::builder("c")
.ns(ns::ECAPS2) .ns(ns::ECAPS2)
.append(ecaps2.hashes.drain(..) .append(ecaps2.hashes.drain(..)
.map(|hash| hash.into()) .map(Element::from)
.collect::<Vec<Element>>()) .collect::<Vec<_>>())
.build() .build()
} }
} }

View file

@ -52,8 +52,8 @@ impl From<Forwarded> for Element {
fn from(forwarded: Forwarded) -> Element { fn from(forwarded: Forwarded) -> Element {
Element::builder("forwarded") Element::builder("forwarded")
.ns(ns::FORWARD) .ns(ns::FORWARD)
.append(match forwarded.delay { Some(delay) => { let elem: Element = delay.into(); Some(elem) }, None => None }) .append(forwarded.delay.map(Element::from))
.append(match forwarded.stanza { Some(stanza) => { let elem: Element = stanza.into(); Some(elem) }, None => None }) .append(forwarded.stanza.map(Element::from))
.build() .build()
} }
} }

View file

@ -147,8 +147,8 @@ impl From<Transport> for Element {
.append(match transport.payload { .append(match transport.payload {
TransportPayload::Candidates(mut candidates) => { TransportPayload::Candidates(mut candidates) => {
candidates.drain(..) candidates.drain(..)
.map(|candidate| candidate.into()) .map(Element::from)
.collect::<Vec<Element>>() .collect::<Vec<_>>()
}, },
TransportPayload::Activated(cid) => { TransportPayload::Activated(cid) => {
vec!(Element::builder("activated") vec!(Element::builder("activated")

View file

@ -167,8 +167,8 @@ impl From<Query> for Element {
.ns(ns::MAM) .ns(ns::MAM)
.attr("queryid", query.queryid) .attr("queryid", query.queryid)
.attr("node", query.node) .attr("node", query.node)
//.append(query.form.map(|form| -> Element { form.into() })) //.append(query.form.map(Element::from))
.append(query.set.map(|set| -> Element { set.into() })) .append(query.set.map(Element::from))
.build() .build()
} }
} }