From 7fa6340f8e989b88e6c8c18bbe68be02b8522af4 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Sun, 4 Sep 2022 15:39:38 +0200 Subject: [PATCH] Inline single-use method consume_next_def_namespace() --- instant-xml/src/de.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/instant-xml/src/de.rs b/instant-xml/src/de.rs index 5ee7660..bd5b165 100644 --- a/instant-xml/src/de.rs +++ b/instant-xml/src/de.rs @@ -167,12 +167,6 @@ impl<'xml> Deserializer<'xml> { Ok(()) } - pub fn consume_next_def_namespace(&mut self) -> Option<&'xml str> { - let ret = self.next_def_namespace; - self.next_def_namespace = None; - ret - } - pub(crate) fn deserialize_element(&mut self, visitor: V) -> Result where V: Visitor<'xml>, @@ -183,10 +177,11 @@ impl<'xml> Deserializer<'xml> { _ => return Err(Error::UnexpectedValue), }; - if tag_data.ns != self.consume_next_def_namespace() { + if tag_data.ns != self.next_def_namespace { return Err(Error::WrongNamespace); } + self.next_def_namespace = None; match self.parser.next() { Some(Ok(XmlRecord::Element(v))) => { let ret = visitor.visit_str(v);