Skip to content

Commit

Permalink
Fix misleading error message on UnexpectedType
Browse files Browse the repository at this point in the history
It's currently named "Unexpected litteral type", but it can also be instantiated when not parsing a litteral, e.g. https://github.com/TedDriggs/darling/blob/224a866727cd9e40c2cd80430852b1ea0deeb40e/core/src/error/mod.rs#L152
This specifically made investigation of #263 more difficult.
  • Loading branch information
Ten0 authored and TedDriggs committed Feb 12, 2024
1 parent 224a866 commit fbcc1b4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/src/error/kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl ErrorKind {
UnknownField(_) => "Unexpected field",
UnsupportedShape { .. } => "Unsupported shape",
UnexpectedFormat(_) => "Unexpected meta-item format",
UnexpectedType(_) => "Unexpected literal type",
UnexpectedType(_) => "Unexpected type",
UnknownValue(_) => "Unknown literal value",
TooFewItems(_) => "Too few items",
TooManyItems(_) => "Too many items",
Expand Down Expand Up @@ -84,7 +84,7 @@ impl fmt::Display for ErrorKind {
Ok(())
}
UnexpectedFormat(ref format) => write!(f, "Unexpected meta-item format `{}`", format),
UnexpectedType(ref ty) => write!(f, "Unexpected literal type `{}`", ty),
UnexpectedType(ref ty) => write!(f, "Unexpected type `{}`", ty),
UnknownValue(ref val) => write!(f, "Unknown literal value `{}`", val),
TooFewItems(ref min) => write!(f, "Too few items: Expected at least {}", min),
TooManyItems(ref max) => write!(f, "Too many items: Expected no more than {}", max),
Expand Down

0 comments on commit fbcc1b4

Please sign in to comment.