use display for serde errors

This commit is contained in:
mos 2024-07-27 16:31:50 +02:00
parent ebf807dcce
commit 87048fc83b
1 changed files with 3 additions and 3 deletions

View File

@ -35,13 +35,13 @@ impl de::Error for Error {
impl Display for Error { impl Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self { match self {
Error::Message(msg) => write!(f, "{}", msg), Error::Message(msg) => write!(f, "{msg}"),
Error::Eof => write!(f, "unexpected EOF"), Error::Eof => write!(f, "unexpected EOF"),
Error::BadOp => write!(f, "bad op"), Error::BadOp => write!(f, "bad op"),
Error::BadEntryCount => write!(f, "wrong amount of entries"), Error::BadEntryCount => write!(f, "wrong amount of entries"),
Error::BadWidth => write!(f, "wrong width for given type"), Error::BadWidth => write!(f, "wrong width for given type"),
Error::BadRead(e) => write!(f, "{:#?}", e), Error::BadRead(e) => write!(f, "{e}"),
Error::BadUtf8Read(e) => write!(f, "{:#?}", e), Error::BadUtf8Read(e) => write!(f, "{e}"),
Error::ExpectedData => write!(f, "expected data"), Error::ExpectedData => write!(f, "expected data"),
Error::ExpectedList => write!(f, "expected list"), Error::ExpectedList => write!(f, "expected list"),
Error::ExpectedConst => write!(f, "expected const"), Error::ExpectedConst => write!(f, "expected const"),