summaryrefslogtreecommitdiffstats
path: root/openpgp/src/serialize/partial_body.rs
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@pep.foundation>2018-05-17 11:34:24 +0200
committerNeal H. Walfield <neal@pep.foundation>2018-05-17 12:03:24 +0200
commit535ed3cde4db9f33b23a471cbc84ed46c4f516f3 (patch)
treea24453e9a41a8c51c840d79763db6575c1a741fc /openpgp/src/serialize/partial_body.rs
parent0951b7ad48289ca34aa5fc0efca6405c6ef1b4e3 (diff)
openpgp: Remove Error::Io.
- Failure can already encapsulate any Error; there is no need to specially wrap io::Error.
Diffstat (limited to 'openpgp/src/serialize/partial_body.rs')
-rw-r--r--openpgp/src/serialize/partial_body.rs23
1 files changed, 15 insertions, 8 deletions
diff --git a/openpgp/src/serialize/partial_body.rs b/openpgp/src/serialize/partial_body.rs
index 09843bdd..0d1ba87a 100644
--- a/openpgp/src/serialize/partial_body.rs
+++ b/openpgp/src/serialize/partial_body.rs
@@ -101,14 +101,21 @@ impl<'a, C: 'a> PartialBodyFilter<'a, C> {
unimplemented!();
}
BodyLength::Full(l as u32).serialize(inner).map_err(
- |e| match e.downcast::<Error>()
- .expect("Unexpected error encoding full length") {
- Error::InvalidArgument(s) =>
- panic!("Error encoding full length: {}", s),
- Error::Io(e) =>
- e,
- _ =>
- panic!("Unexpected error encoding full length"),
+ |e| {
+ match e.downcast::<io::Error>() {
+ Ok(err) => err,
+ Err(e) => {
+ match e.downcast::<Error>()
+ .expect("Unexpected error encoding full length")
+ {
+ Error::InvalidArgument(s) =>
+ panic!("Error encoding full length: {}", s),
+ _ =>
+ panic!("Unexpected error encoding \
+ full length"),
+ }
+ }
+ }
})?;
// Write the body.