Inline single-use method check_close_tag()

This commit is contained in:
Dirkjan Ochtman 2022-09-04 15:38:41 +02:00
parent 40b47aed37
commit 31c9ce5873
1 changed files with 9 additions and 13 deletions

View File

@ -119,7 +119,15 @@ impl<'xml> Deserializer<'xml> {
let ret = visitor.visit_struct(self)?; let ret = visitor.visit_struct(self)?;
// Process close tag // Process close tag
self.check_close_tag(name)?; let item = match self.parser.next() {
Some(item) => item?,
None => return Err(Error::MissingTag),
};
match item {
XmlRecord::Close(v) if v == name => {}
_ => return Err(Error::UnexpectedTag),
}
// Removing parser namespaces // Removing parser namespaces
let _ = new_parser_namespaces let _ = new_parser_namespaces
@ -202,18 +210,6 @@ impl<'xml> Deserializer<'xml> {
None => Err(Error::UnexpectedEndOfStream), None => Err(Error::UnexpectedEndOfStream),
} }
} }
fn check_close_tag(&mut self, name: &str) -> Result<(), Error> {
let item = match self.parser.next() {
Some(item) => item?,
None => return Err(Error::MissingTag),
};
match item {
XmlRecord::Close(v) if v == name => Ok(()),
_ => Err(Error::UnexpectedTag),
}
}
} }
pub struct XmlParser<'xml> { pub struct XmlParser<'xml> {