Skip to content

Commit 1bb4cf6

Browse files
authored
Merge pull request #208 from iancormac84/undeprecate
Remove deprecated uses of Error::description.
2 parents da4a4d7 + 89b0750 commit 1bb4cf6

File tree

1 file changed

+3
-52
lines changed

1 file changed

+3
-52
lines changed

src/de/error.rs

+3-52
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ impl fmt::Display for Error {
6262
match *self {
6363
Error::IoError(ref s) => write!(f, "{}", s),
6464
Error::Message(ref s) => write!(f, "{}", s),
65-
Error::Parser(_, pos) => write!(f, "{}: {}", pos, self.description()),
65+
Error::Parser(_, pos) => write!(f, "{}: {}", pos, self),
6666
}
6767
}
6868
}
@@ -73,56 +73,7 @@ impl de::Error for Error {
7373
}
7474
}
7575

76-
impl StdError for Error {
77-
fn description(&self) -> &str {
78-
match *self {
79-
Error::IoError(ref s) => s,
80-
Error::Message(ref e) => e,
81-
Error::Parser(ref kind, _) => match *kind {
82-
ParseError::Base64Error(ref e) => e.description(),
83-
ParseError::Eof => "Unexpected end of file",
84-
ParseError::ExpectedArray => "Expected array",
85-
ParseError::ExpectedArrayEnd => "Expected end of array",
86-
ParseError::ExpectedAttribute => "Expected an enable attribute",
87-
ParseError::ExpectedAttributeEnd => {
88-
"Expected closing `)` and `]` after the attribute"
89-
}
90-
ParseError::ExpectedBoolean => "Expected boolean",
91-
ParseError::ExpectedComma => "Expected comma",
92-
ParseError::ExpectedEnum => "Expected enum",
93-
ParseError::ExpectedChar => "Expected char",
94-
ParseError::ExpectedFloat => "Expected float",
95-
ParseError::ExpectedInteger => "Expected integer",
96-
ParseError::ExpectedOption => "Expected option",
97-
ParseError::ExpectedOptionEnd => "Expected end of option",
98-
ParseError::ExpectedMap => "Expected map",
99-
ParseError::ExpectedMapColon => "Expected colon",
100-
ParseError::ExpectedMapEnd => "Expected end of map",
101-
ParseError::ExpectedStruct => "Expected struct",
102-
ParseError::ExpectedStructEnd => "Expected end of struct",
103-
ParseError::ExpectedUnit => "Expected unit",
104-
ParseError::ExpectedStructName => "Expected struct name",
105-
ParseError::ExpectedString => "Expected string",
106-
ParseError::ExpectedStringEnd => "Expected string end",
107-
ParseError::ExpectedIdentifier => "Expected identifier",
108-
109-
ParseError::InvalidEscape(_) => "Invalid escape sequence",
110-
111-
ParseError::IntegerOutOfBounds => "Integer is out of bounds",
112-
113-
ParseError::NoSuchExtension(_) => "No such RON extension",
114-
115-
ParseError::Utf8Error(ref e) => e.description(),
116-
ParseError::UnclosedBlockComment => "Unclosed block comment",
117-
ParseError::UnderscoreAtBeginning => "Found underscore at the beginning",
118-
ParseError::UnexpectedByte(_) => "Unexpected byte",
119-
ParseError::TrailingCharacters => "Non-whitespace trailing characters",
120-
121-
ParseError::__NonExhaustive => unimplemented!(),
122-
},
123-
}
124-
}
125-
}
76+
impl StdError for Error {}
12677

12778
impl From<Utf8Error> for ParseError {
12879
fn from(e: Utf8Error) -> Self {
@@ -144,6 +95,6 @@ impl From<Utf8Error> for Error {
14495

14596
impl From<io::Error> for Error {
14697
fn from(e: io::Error) -> Self {
147-
Error::IoError(e.description().to_string())
98+
Error::IoError(e.to_string())
14899
}
149100
}

0 commit comments

Comments
 (0)