Make PngError non-exhaustive for forward compatibility
This commit is contained in:
parent
e1cf3bf54b
commit
ebd94934a5
1 changed files with 5 additions and 0 deletions
|
|
@ -1,10 +1,14 @@
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
|
// TODO: Use `#[non_exhaustive]` once stabilized
|
||||||
|
// https://github.com/rust-lang/rust/issues/44109
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum PngError {
|
pub enum PngError {
|
||||||
DeflatedDataTooLong(usize),
|
DeflatedDataTooLong(usize),
|
||||||
Other(Box<str>),
|
Other(Box<str>),
|
||||||
|
#[doc(hidden)]
|
||||||
|
_Nonexhaustive,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Error for PngError {
|
impl Error for PngError {
|
||||||
|
|
@ -20,6 +24,7 @@ impl fmt::Display for PngError {
|
||||||
match *self {
|
match *self {
|
||||||
PngError::DeflatedDataTooLong(_) => f.write_str("deflated data too long"),
|
PngError::DeflatedDataTooLong(_) => f.write_str("deflated data too long"),
|
||||||
PngError::Other(ref s) => f.write_str(s),
|
PngError::Other(ref s) => f.write_str(s),
|
||||||
|
PngError::_Nonexhaustive => unreachable!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue