aboutsummaryrefslogtreecommitdiff
path: root/src/ber/serialize.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/ber/serialize.rs')
-rw-r--r--src/ber/serialize.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/ber/serialize.rs b/src/ber/serialize.rs
index 7ffedc2..8c82e29 100644
--- a/src/ber/serialize.rs
+++ b/src/ber/serialize.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "std")]
use crate::ber::*;
use crate::oid::Oid;
use cookie_factory::bytes::be_u8;
@@ -8,8 +9,6 @@ use cookie_factory::sequence::tuple;
use cookie_factory::{GenError, SerializeFn};
use std::io::Write;
-// we do not use .copied() for compatibility with 1.34
-#[allow(clippy::map_clone)]
fn encode_length<'a, W: Write + 'a, Len: Into<BerSize>>(len: Len) -> impl SerializeFn<W> + 'a {
let l = len.into();
move |out| {
@@ -23,7 +22,7 @@ fn encode_length<'a, W: Write + 'a, Len: Into<BerSize>>(len: Len) -> impl Serial
let v: Vec<u8> = sz
.to_be_bytes()
.iter()
- .map(|&x| x)
+ .cloned()
.skip_while(|&b| b == 0)
.collect();
let b0 = 0b1000_0000 | (v.len() as u8);
@@ -108,8 +107,6 @@ pub fn ber_encode_tagged_implicit<'a, W: Write + Default + AsRef<[u8]> + 'a>(
}
}
-// we do not use .copied() for compatibility with 1.34
-#[allow(clippy::map_clone)]
fn ber_encode_object_content<'a, W: Write + Default + AsRef<[u8]> + 'a>(
c: &'a BerObjectContent,
) -> impl SerializeFn<W> + 'a {
@@ -129,7 +126,7 @@ fn ber_encode_object_content<'a, W: Write + Default + AsRef<[u8]> + 'a>(
let v: Vec<u8> = i
.to_be_bytes()
.iter()
- .map(|&x| x)
+ .cloned()
.skip_while(|&b| b == 0)
.collect();
slice(v)(out)
@@ -158,12 +155,13 @@ fn ber_encode_object_content<'a, W: Write + Default + AsRef<[u8]> + 'a>(
None => slice(&[])(out), // XXX encode NOP ?
}
}
+ BerObjectContent::Private(_hdr, bytes) => slice(bytes)(out),
BerObjectContent::Tagged(_class, _tag, inner) => {
// directly encode inner object
// XXX wrong, we should wrap it!
ber_encode_object(inner)(out)
}
- BerObjectContent::Unknown(_tag, s) => slice(s)(out),
+ BerObjectContent::Unknown(_, _, s) => slice(s)(out),
}
}