Skip to content

Commit

Permalink
Remove deprecated error descriptions
Browse files Browse the repository at this point in the history
Error descriptions are soft-deprecated
since 1.27.0, and hard-deprecated since
1.42.0.

See also rust-lang/rust#66919
  • Loading branch information
est31 committed Jun 30, 2020
1 parent b79d65d commit 1da041d
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions src/reading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,6 @@ pub enum OggReadError {
}

impl error::Error for OggReadError {
fn description(&self) -> &str {
match self {
&OggReadError::NoCapturePatternFound => "No Ogg capture pattern found",
&OggReadError::InvalidStreamStructVer(_) =>
"A non zero stream structure version was passed",
&OggReadError::HashMismatch(_, _) => "CRC32 hash mismatch",
&OggReadError::ReadError(_) => "I/O error",
&OggReadError::InvalidData => "Constraint violated",
}
}

fn cause(&self) -> Option<&error::Error> {
match self {
&OggReadError::ReadError(ref err) => Some(err as &error::Error),
Expand All @@ -61,7 +50,15 @@ impl error::Error for OggReadError {

impl Display for OggReadError {
fn fmt(&self, fmt :&mut Formatter) -> Result<(), FmtError> {
write!(fmt, "{}", error::Error::description(self))
let description = match self {
&OggReadError::NoCapturePatternFound => "No Ogg capture pattern found",
&OggReadError::InvalidStreamStructVer(_) =>
"A non zero stream structure version was passed",
&OggReadError::HashMismatch(_, _) => "CRC32 hash mismatch",
&OggReadError::ReadError(_) => "I/O error",
&OggReadError::InvalidData => "Constraint violated",
};
write!(fmt, "{}", description)
}
}

Expand Down

0 comments on commit 1da041d

Please sign in to comment.