diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-09-10 13:23:45 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-09-10 13:33:02 +0200 |
commit | ff5a8f2536193b80af2d1bcf308db9d59b084e83 (patch) | |
tree | a5149a1bfeb43ee20783c5f77d8833331fe6e991 /openpgp | |
parent | f07f3a5c868ee3951339263768686c2743d1c9ec (diff) |
openpgp: Prevent monomorphization of Compressor::new_naked.
Diffstat (limited to 'openpgp')
-rw-r--r-- | openpgp/src/serialize/mod.rs | 4 | ||||
-rw-r--r-- | openpgp/src/serialize/stream.rs | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/openpgp/src/serialize/mod.rs b/openpgp/src/serialize/mod.rs index 91a26daf..5bdf6974 100644 --- a/openpgp/src/serialize/mod.rs +++ b/openpgp/src/serialize/mod.rs @@ -1676,8 +1676,8 @@ impl Serialize for CompressedData { } let o = stream::Message::new(o); - let mut o = - stream::Compressor::new_naked(o, self.algorithm(), None, 0)?; + let mut o = stream::Compressor::new_naked( + o, self.algorithm(), Default::default(), 0)?; // Serialize the packets. if let Some(ref children) = self.common.children { diff --git a/openpgp/src/serialize/stream.rs b/openpgp/src/serialize/stream.rs index 7d94616c..d69f51fc 100644 --- a/openpgp/src/serialize/stream.rs +++ b/openpgp/src/serialize/stream.rs @@ -765,6 +765,7 @@ impl<'a> Compressor<'a> { where L: Into<Option<writer::CompressionLevel>> { let mut inner = writer::BoxStack::from(inner); + let compression_level = compression_level.into().unwrap_or_default(); let level = inner.cookie_ref().level + 1; // Packet header. @@ -779,12 +780,11 @@ impl<'a> Compressor<'a> { /// Creates a new compressor using the given algorithm. pub(crate) // For CompressedData::serialize. - fn new_naked<L>(mut inner: writer::Stack<'a, Cookie>, - algo: CompressionAlgorithm, - compression_level: L, - level: usize) - -> Result<writer::Stack<'a, Cookie>> - where L: Into<Option<writer::CompressionLevel>> + fn new_naked(mut inner: writer::Stack<'a, Cookie>, + algo: CompressionAlgorithm, + compression_level: writer::CompressionLevel, + level: usize) + -> Result<writer::Stack<'a, Cookie>> { // Compressed data header. inner.as_mut().write_u8(algo.into())?; |