From aa45a74bb4ddd12a774d71f3c37857aa2bd5235f Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Tue, 13 Dec 2022 14:14:21 +0100 Subject: [PATCH] Improve error for unexpected nodes --- instant-xml-macros/src/de.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/instant-xml-macros/src/de.rs b/instant-xml-macros/src/de.rs index 4513e1d..8cd62b1 100644 --- a/instant-xml-macros/src/de.rs +++ b/instant-xml-macros/src/de.rs @@ -260,6 +260,7 @@ fn deserialize_struct( }); let ident = &input.ident; + let ident_str = format!("{ident}"); let name = container_meta.tag(); let default_namespace = container_meta.default_namespace(); let generics = container_meta.xml_generics(borrowed); @@ -321,7 +322,7 @@ fn deserialize_struct( } } #direct - node => return Err(Error::UnexpectedNode(format!("{:?}", node))), + node => return Err(Error::UnexpectedNode(format!("{:?} in {}", node, #ident_str))), } }