diff --git a/scroll_derive/src/lib.rs b/scroll_derive/src/lib.rs index 6d73811..8ff5c02 100644 --- a/scroll_derive/src/lib.rs +++ b/scroll_derive/src/lib.rs @@ -66,10 +66,10 @@ fn custom_ctx(field: &syn::Field) -> Option { expr = Some(value.parse::()?); // parsed #[scroll(ctx = expr)] return Ok(()); } - Err(meta.error(format!( - "unrecognized attribute: {}", - meta.path.get_ident().unwrap() - ))) + Err(meta.error(match meta.path.get_ident() { + Some(ident) => format!("unrecognized attribute: {ident}"), + None => "unrecognized and invalid attribute".to_owned(), + })) }); match res { Ok(_) => expr.map(|x| x.into_token_stream()),