Skip to content

Commit

Permalink
Handle Unexpected::Unit in Error::invalid_value
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jan 26, 2024
1 parent 296fafb commit 62ca3e4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,15 @@ impl de::Error for Error {
exp,
))
}

#[cold]
fn invalid_value(unexp: de::Unexpected, exp: &dyn de::Expected) -> Self {
Error::custom(format_args!(
"invalid value: {}, expected {}",
JsonUnexpected(unexp),
exp,
))
}
}

impl ser::Error for Error {
Expand Down

0 comments on commit 62ca3e4

Please sign in to comment.