@@ -62,7 +62,7 @@ impl fmt::Display for Error {
62
62
match * self {
63
63
Error :: IoError ( ref s) => write ! ( f, "{}" , s) ,
64
64
Error :: Message ( ref s) => write ! ( f, "{}" , s) ,
65
- Error :: Parser ( _, pos) => write ! ( f, "{}: {}" , pos, self . description ( ) ) ,
65
+ Error :: Parser ( _, pos) => write ! ( f, "{}: {}" , pos, self ) ,
66
66
}
67
67
}
68
68
}
@@ -73,56 +73,7 @@ impl de::Error for Error {
73
73
}
74
74
}
75
75
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 { }
126
77
127
78
impl From < Utf8Error > for ParseError {
128
79
fn from ( e : Utf8Error ) -> Self {
@@ -144,6 +95,6 @@ impl From<Utf8Error> for Error {
144
95
145
96
impl From < io:: Error > for Error {
146
97
fn from ( e : io:: Error ) -> Self {
147
- Error :: IoError ( e. description ( ) . to_string ( ) )
98
+ Error :: IoError ( e. to_string ( ) )
148
99
}
149
100
}
0 commit comments