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

@ -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.and_then(|value| Some(String::from(value))))
.attr("to", presence.to.and_then(|value| Some(String::from(value))))
.attr("from", presence.from.map(String::from))
.attr("to", presence.to.map(String::from))
.attr("id", presence.id)
.attr("type", presence.type_)
.append(presence.show)