Skip to content
This repository has been archived by the owner on Sep 24, 2022. It is now read-only.

Commit

Permalink
Merge pull request #365 from AnderEnder/remove-deprecated-error-descr…
Browse files Browse the repository at this point in the history
…iption

Remove deprecated Error::description
  • Loading branch information
ehuss authored Dec 22, 2019
2 parents 60b8743 + b9507d8 commit 1b8e0d7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 50 deletions.
6 changes: 1 addition & 5 deletions src/datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,4 @@ impl fmt::Display for DatetimeParseError {
}
}

impl error::Error for DatetimeParseError {
fn description(&self) -> &str {
"failed to parse datetime"
}
}
impl error::Error for DatetimeParseError {}
30 changes: 1 addition & 29 deletions src/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2153,35 +2153,7 @@ impl fmt::Display for Error {
}
}

impl error::Error for Error {
fn description(&self) -> &str {
match self.inner.kind {
ErrorKind::UnexpectedEof => "unexpected eof encountered",
ErrorKind::InvalidCharInString(_) => "invalid char in string",
ErrorKind::InvalidEscape(_) => "invalid escape in string",
ErrorKind::InvalidHexEscape(_) => "invalid hex escape in string",
ErrorKind::InvalidEscapeValue(_) => "invalid escape value in string",
ErrorKind::NewlineInString => "newline in string found",
ErrorKind::Unexpected(_) => "unexpected or invalid character",
ErrorKind::UnterminatedString => "unterminated string",
ErrorKind::NewlineInTableKey => "found newline in table key",
ErrorKind::Wanted { .. } => "expected a token but found another",
ErrorKind::NumberInvalid => "invalid number",
ErrorKind::DateInvalid => "invalid date",
ErrorKind::DuplicateTable(_) => "duplicate table",
ErrorKind::RedefineAsArray => "table redefined as array",
ErrorKind::EmptyTableKey => "empty table key found",
ErrorKind::MultilineStringKey => "invalid multiline string for key",
ErrorKind::Custom => "a custom error",
ErrorKind::ExpectedTuple(_) => "expected table length",
ErrorKind::ExpectedTupleIndex { .. } => "expected table key",
ErrorKind::ExpectedEmptyTable => "expected empty table",
ErrorKind::DottedKeyInvalidType => "dotted key invalid type",
ErrorKind::UnexpectedKeys { .. } => "unexpected keys in table",
ErrorKind::__Nonexhaustive => panic!(),
}
}
}
impl error::Error for Error {}

impl de::Error for Error {
fn custom<T: fmt::Display>(msg: T) -> Error {
Expand Down
17 changes: 1 addition & 16 deletions src/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1542,22 +1542,7 @@ impl fmt::Display for Error {
}
}

impl error::Error for Error {
fn description(&self) -> &str {
match *self {
Error::UnsupportedType => "unsupported Rust type",
Error::KeyNotString => "map key was not a string",
Error::ValueAfterTable => "values must be emitted before tables",
Error::DateInvalid => "a serialized date was invalid",
Error::NumberInvalid => "a serialized number was invalid",
Error::UnsupportedNone => "unsupported None value",
Error::Custom(_) => "custom error",
Error::KeyNewline => unreachable!(),
Error::ArrayMixedType => unreachable!(),
Error::__Nonexhaustive => panic!(),
}
}
}
impl error::Error for Error {}

impl ser::Error for Error {
fn custom<T: fmt::Display>(msg: T) -> Error {
Expand Down

0 comments on commit 1b8e0d7

Please sign in to comment.