From f6a9d662887f60375e3cd28639ebafe324581c26 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Sat, 26 Nov 2022 12:52:13 -0800 Subject: [PATCH] Don't fabricate empty string in error case --- instant-xml/src/de.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/instant-xml/src/de.rs b/instant-xml/src/de.rs index f65ac58..3a469df 100644 --- a/instant-xml/src/de.rs +++ b/instant-xml/src/de.rs @@ -1,8 +1,9 @@ use std::collections::{BTreeMap, VecDeque}; -use super::{Error, Id}; use xmlparser::{ElementEnd, Token, Tokenizer}; +use crate::{Kind, Error, Id}; + pub struct Deserializer<'cx, 'xml> { pub(crate) local: &'xml str, prefix: Option<&'xml str>, @@ -33,7 +34,7 @@ impl<'cx, 'xml> Deserializer<'cx, 'xml> { Some(Ok(Node::Text(s))) => (s, true), Some(Ok(_)) => return Err(Error::ExpectedScalar), Some(Err(e)) => return Err(e), - None => return Ok(""), + None => return Err(Error::MissingValue(&Kind::Scalar)), }; if element {