From 84355f9e1dd7173133a0e2b9799499cc683352c3 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sat, 12 May 2018 20:25:59 +0200 Subject: [PATCH] macros: Simplify generated code for check_no_attributes!(). --- src/macros.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/macros.rs b/src/macros.rs index 3eded458..8fd05770 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -206,7 +206,9 @@ macro_rules! check_no_children { macro_rules! check_no_attributes { ($elem:ident, $name:tt) => ( - check_no_unknown_attributes!($elem, $name, []); + for _ in $elem.attrs() { + return Err(Error::ParseError(concat!("Unknown attribute in ", $name, " element."))); + } ); }