rsm: Change if .is_some() { .unwrap() } into if let Some().

This commit is contained in:
Emmanuel Gil Peyrot 2017-07-29 03:03:45 +01:00
parent f83fe92244
commit dfb736a973

View file

@ -97,8 +97,8 @@ impl From<Set> for Element {
if set.before.is_some() { if set.before.is_some() {
elem.append_child(Element::builder("before").ns(ns::RSM).append(set.before).build()); elem.append_child(Element::builder("before").ns(ns::RSM).append(set.before).build());
} }
if set.count.is_some() { if let Some(count) = set.count {
elem.append_child(Element::builder("count").ns(ns::RSM).append(format!("{}", set.count.unwrap())).build()); elem.append_child(Element::builder("count").ns(ns::RSM).append(format!("{}", count)).build());
} }
if set.first.is_some() { if set.first.is_some() {
elem.append_child(Element::builder("first") elem.append_child(Element::builder("first")
@ -106,14 +106,14 @@ impl From<Set> for Element {
.attr("index", set.first_index) .attr("index", set.first_index)
.append(set.first).build()); .append(set.first).build());
} }
if set.index.is_some() { if let Some(index) = set.index {
elem.append_child(Element::builder("index").ns(ns::RSM).append(format!("{}", set.index.unwrap())).build()); elem.append_child(Element::builder("index").ns(ns::RSM).append(format!("{}", index)).build());
} }
if set.last.is_some() { if set.last.is_some() {
elem.append_child(Element::builder("last").ns(ns::RSM).append(set.last).build()); elem.append_child(Element::builder("last").ns(ns::RSM).append(set.last).build());
} }
if set.max.is_some() { if let Some(max) = set.max {
elem.append_child(Element::builder("max").ns(ns::RSM).append(format!("{}", set.max.unwrap())).build()); elem.append_child(Element::builder("max").ns(ns::RSM).append(format!("{}", max)).build());
} }
elem elem
} }