diff --git a/src/reading.rs b/src/reading.rs index d15b02b..68a9274 100644 --- a/src/reading.rs +++ b/src/reading.rs @@ -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), @@ -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) } }