Mark more tag enums as non_exhaustive

This commit is contained in:
Andreas Molzer committed 2022-11-10 12:45:04 +01:00
1 parent c900129f2c
commit 0e9f8e3b5b
4 files changed
+2 -13

No files matched your search

+1 -7
View File
@@ -17,6 +17,7 @@ use self::Value::{
#[allow(unused_qualifications)]
#[derive(Debug, Clone, PartialEq)]
#[non_exhaustive]
pub enum Value {
Byte(u8),
Short(u16),
@@ -34,8 +35,6 @@ pub enum Value {
Ascii(String),
Ifd(u32),
IfdBig(u64),
#[doc(hidden)] // Do not match against this.
__NonExhaustive,
}
impl Value {
@@ -361,7 +360,6 @@ impl Entry {
| Type::RATIONAL
| Type::SRATIONAL
| Type::IFD8 => 8,
Type::__NonExhaustive => unreachable!(),
};
let value_bytes = match self.count.checked_mul(tag_size) {
@@ -398,7 +396,6 @@ impl Entry {
| Type::SLONG
| Type::FLOAT
| Type::IFD => unreachable!(),
Type::__NonExhaustive => unreachable!(),
});
}
@@ -444,7 +441,6 @@ impl Entry {
reader.goto_offset(self.r(bo).read_u32()?.into())?;
IfdBig(reader.read_u64()?)
}
Type::__NonExhaustive => unreachable!(),
});
}
@@ -528,7 +524,6 @@ impl Entry {
| Type::IFD8 => {
unreachable!()
}
Type::__NonExhaustive => unreachable!(),
}
}
@@ -611,7 +606,6 @@ impl Entry {
}
Ok(Ascii(String::from_utf8(out)?))
}
Type::__NonExhaustive => unreachable!(),
}
}
-1
View File
@@ -464,7 +464,6 @@ impl Image {
TiffUnsupportedError::FloatingPointPredictor(color_type),
));
}
Predictor::__NonExhaustive => unreachable!(),
},
(type_, _) => {
return Err(TiffError::UnsupportedError(
-1
View File
@@ -429,7 +429,6 @@ fn fix_endianness_and_predict(
_ => unreachable!("Caller should have validated arguments. Please file a bug."),
}
}
Predictor::__NonExhaustive => unreachable!(),
}
}
+1 -4
View File
@@ -9,11 +9,9 @@ macro_rules! tags {
} => {
$( #[$enum_attr] )*
#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)]
#[non_exhaustive]
pub enum $name {
$($(#[$ident_attr])* $tag,)*
// FIXME: switch to non_exhaustive once stabilized and compiler requirement new enough
#[doc(hidden)]
__NonExhaustive,
$(
#[doc = $unknown_doc]
Unknown($ty),
@@ -34,7 +32,6 @@ macro_rules! tags {
match *self {
$( $name::$tag => $val, )*
$( $name::Unknown(n) => { $unknown_doc; n }, )*
$name::__NonExhaustive => unreachable!(),
}
}
}