diff --git a/xso/src/lib.rs b/xso/src/lib.rs index 9daaa2d0..a5b073da 100644 --- a/xso/src/lib.rs +++ b/xso/src/lib.rs @@ -231,7 +231,7 @@ impl AsXmlText for &str { impl AsXmlText for Box { fn as_xml_text(&self) -> Result, self::error::Error> { - T::as_xml_text(&*self) + T::as_xml_text(self) } } diff --git a/xso/src/rxml_util.rs b/xso/src/rxml_util.rs index 7f5fcd60..5b2a54fd 100644 --- a/xso/src/rxml_util.rs +++ b/xso/src/rxml_util.rs @@ -77,15 +77,13 @@ impl Item<'_> { } /// Return an [`rxml::Item`], which borrows data from this item. - pub fn as_rxml_item<'x>(&'x self) -> rxml::Item<'x> { + pub fn as_rxml_item(&self) -> rxml::Item<'_> { match self { Self::XmlDeclaration(ref v) => rxml::Item::XmlDeclaration(*v), - Self::ElementHeadStart(ref ns, ref name) => rxml::Item::ElementHeadStart(ns, &**name), - Self::Attribute(ref ns, ref name, ref value) => { - rxml::Item::Attribute(ns, &**name, &**value) - } + Self::ElementHeadStart(ref ns, ref name) => rxml::Item::ElementHeadStart(ns, name), + Self::Attribute(ref ns, ref name, ref value) => rxml::Item::Attribute(ns, name, value), Self::ElementHeadEnd => rxml::Item::ElementHeadEnd, - Self::Text(ref value) => rxml::Item::Text(&**value), + Self::Text(ref value) => rxml::Item::Text(value), Self::ElementFoot => rxml::Item::ElementFoot, } } @@ -185,7 +183,7 @@ impl<'x, I: Iterator, crate::error::Error>>> ItemToEvent< } impl ItemToEvent { - fn update<'x>(&mut self, item: Item<'x>) -> Result, crate::error::Error> { + fn update(&mut self, item: Item<'_>) -> Result, crate::error::Error> { assert!(self.event_buffer.is_none()); match item { Item::XmlDeclaration(v) => { @@ -268,9 +266,8 @@ impl<'x, I: Iterator, crate::error::Error>>> Iterator for Some(Err(e)) => return Some(Err(e)), None => return None, }; - match self.update(item).transpose() { - Some(v) => return Some(v), - None => (), + if let Some(v) = self.update(item).transpose() { + return Some(v); } } }