Skip to content

Commit

Permalink
Add struct name to required field error
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelbuesing committed Feb 6, 2024
1 parent 85e0150 commit a82fb78
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions yaserde_derive/src/de/expand_struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,11 +347,12 @@ pub fn parse(
quote! { #label: #value_label.unwrap_or_else(|| #default_function()), }
} else {
let error = format!(
"{} is a required field",
"{} is a required field of {}",
label
.as_ref()
.map(|label| label.to_string())
.unwrap_or_default()
.unwrap_or_default(),
name.to_string()

Check failure on line 355 in yaserde_derive/src/de/expand_struct.rs

View workflow job for this annotation

GitHub Actions / Clippy

`to_string` applied to a type that implements `Display` in `format!` args
);

quote! { #label: #value_label.ok_or_else(|| #error.to_string())?, }
Expand Down

0 comments on commit a82fb78

Please sign in to comment.