From b6d59a9aac0fa972b587befb766c9b8e577c8f7a Mon Sep 17 00:00:00 2001 From: lthoerner Date: Thu, 5 Sep 2024 22:23:02 -0700 Subject: [PATCH] return error instead of empty attributes --- core/parse_helpers.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/parse_helpers.rs b/core/parse_helpers.rs index 18748bd..56358c4 100644 --- a/core/parse_helpers.rs +++ b/core/parse_helpers.rs @@ -998,7 +998,12 @@ where index += 1; } } - Ok(tokens.into_iter()) + + if !tokens.is_empty() { + Ok(tokens.into_iter()) + } else { + Err(syn::Error::new(Span::call_site(), "no attributes found")) + } } /// Gets the first [`Span`](proc_macro2::Span) in a list of path names and spans.