From 6e1f24c385a507d83ae2adf8757923a511725487 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Wed, 24 Jul 2024 21:24:15 +0200 Subject: [PATCH] =?UTF-8?q?xso:=20Apply=20clippy=E2=80=99s=20suggestions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xso/src/lib.rs | 2 +- xso/src/rxml_util.rs | 17 +++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) 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); } } }