Skip to content

Commit a46e366

Browse files
author
Harris Kaufmann
committed
fix obvious issues
1 parent 481ea83 commit a46e366

File tree

3 files changed

+4
-14
lines changed

3 files changed

+4
-14
lines changed

der/src/tag.rs

+2
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ fn parse_parts<'a, R: Reader<'a>>(first_byte: u8, reader: &mut R) -> Result<(boo
377377
}
378378

379379
impl Encode for Tag {
380+
#[allow(clippy::cast_possible_truncation)]
380381
fn encoded_len(&self) -> Result<Length> {
381382
let number = self.number().value();
382383

@@ -389,6 +390,7 @@ impl Encode for Tag {
389390
Ok(length)
390391
}
391392

393+
#[allow(clippy::cast_possible_truncation)]
392394
fn encode(&self, writer: &mut impl Writer) -> Result<()> {
393395
let mut first_byte = self.class() as u8 | u8::from(self.is_constructed()) << 5;
394396

der/src/tag/number.rs

+1-13
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use core::fmt;
1717
/// encoded by using a leading tag number of 31 (`0b11111`).
1818
///
1919
/// This library supports tag numbers with 16 bit values
20+
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2021
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)]
2122
pub struct TagNumber(pub u16);
2223

@@ -157,16 +158,3 @@ impl fmt::Display for TagNumber {
157158
write!(f, "{}", self.0)
158159
}
159160
}
160-
161-
// Implement by hand because the derive would create invalid values.
162-
// Use the constructor to create a valid value.
163-
#[cfg(feature = "arbitrary")]
164-
impl<'a> arbitrary::Arbitrary<'a> for TagNumber {
165-
fn arbitrary(u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result<Self> {
166-
Ok(Self::new(u.int_in_range(0..=Self::MAX)?))
167-
}
168-
169-
fn size_hint(depth: usize) -> (usize, Option<usize>) {
170-
u8::size_hint(depth)
171-
}
172-
}

pkcs8/tests/encrypted_private_key.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use der::asn1::OctetStringRef;
66
use hex_literal::hex;
7-
use pkcs8::{pkcs5::pbes2, EncryptedPrivateKeyInfoRef};
7+
use pkcs8::{pkcs5::pbes2, EncryptedPrivateKeyInfoRef, PrivateKeyInfoRef};
88

99
#[cfg(feature = "alloc")]
1010
use der::Encode;

0 commit comments

Comments
 (0)