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

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