1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-01-22 23:05:56 +01:00

Remove description() (#19)

* Remove `description()`

It has been deprecated.
This commit is contained in:
Yuki Okushi 2020-01-11 22:12:11 +09:00 committed by GitHub
parent 4d9fb6825c
commit d757f44557
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,22 +27,21 @@ pub enum ParseError {
impl fmt::Display for ParseError { impl fmt::Display for ParseError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str(self.description()) let display = match self {
ParseError::Invalid => "Invalid header value".to_string(),
ParseError::MissingScheme => {
"Missing authorization scheme".to_string()
}
ParseError::MissingField(_) => "Missing header field".to_string(),
ParseError::ToStrError(e) => e.to_string(),
ParseError::Base64DecodeError(e) => e.to_string(),
ParseError::Utf8Error(e) => e.to_string(),
};
f.write_str(&display)
} }
} }
impl Error for ParseError { impl Error for ParseError {
fn description(&self) -> &str {
match self {
ParseError::Invalid => "Invalid header value",
ParseError::MissingScheme => "Missing authorization scheme",
ParseError::MissingField(_) => "Missing header field",
ParseError::ToStrError(e) => e.description(),
ParseError::Base64DecodeError(e) => e.description(),
ParseError::Utf8Error(e) => e.description(),
}
}
fn source(&self) -> Option<&(dyn Error + 'static)> { fn source(&self) -> Option<&(dyn Error + 'static)> {
match self { match self {
ParseError::Invalid => None, ParseError::Invalid => None,