Replace .and_then() with .map() wherever it makes sense.

This commit is contained in:
Emmanuel Gil Peyrot 2017-07-21 01:19:34 +01:00
commit 21cee25b27
6 changed files with 16 additions and 16 deletions

View file

@ -272,8 +272,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.and_then(|value| Some(String::from(value))))
.attr("to", iq.to.and_then(|value| Some(String::from(value))))
.attr("from", iq.from.map(String::from))
.attr("to", iq.to.map(String::from))
.attr("id", iq.id)
.attr("type", &iq.payload)
.build();