From 62ca3e4c01c2e62cd5c2a32e9104f386e5ce7808 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 26 Jan 2024 13:04:35 -0800 Subject: [PATCH] Handle Unexpected::Unit in Error::invalid_value --- src/error.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/error.rs b/src/error.rs index c260fe17e..0e3323972 100644 --- a/src/error.rs +++ b/src/error.rs @@ -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 {