diff --git a/packages/yew-macro/src/props/prop.rs b/packages/yew-macro/src/props/prop.rs index 5a1aa65f649..f0641c2e477 100644 --- a/packages/yew-macro/src/props/prop.rs +++ b/packages/yew-macro/src/props/prop.rs @@ -334,8 +334,7 @@ impl PropList { if prop.is_some() { if let Some(other_prop) = self.get_by_label(key) { return Err(syn::Error::new_spanned( - // OK to unwrap since pop/get_by_label can be Some only if PropLabel::Static - String::try_from(&other_prop.label).unwrap(), + &other_prop.label, format!("`{key}` can only be specified once"), )); } @@ -379,8 +378,7 @@ impl PropList { pub fn check_no_duplicates(&self) -> syn::Result<()> { crate::join_errors(self.iter_duplicates().map(|prop| { syn::Error::new_spanned( - // OK to unwrap since iter_duplicates iterates only over PropLabel::Static - String::try_from(&prop.label).unwrap(), + &prop.label, format!( "`{}` can only be specified once but is given here again", String::try_from(&prop.label).unwrap()