py* macro raises better error for duplicated item

This commit is contained in:
Jeong YunWon committed 2020-10-19 18:11:44 +09:00
1 parent efa809bd17
commit 1f8213082c
1 file changed
+2 -2
+2 -2
View File
@@ -27,10 +27,10 @@ impl ItemNursery {
cfgs: Vec<Attribute>,
tokens: TokenStream,
) -> Result<()> {
if let Some(existing) = self.0.insert((name, cfgs), tokens) {
if let Some(existing) = self.0.insert((name.clone(), cfgs), tokens) {
Err(syn::Error::new_spanned(
existing,
"Duplicated #[py*] attribute found",
format!("Duplicated #[py*] attribute found for '{}'", name),
))
} else {
Ok(())