diff --git a/base16ct/src/error.rs b/base16ct/src/error.rs index 348de6e62..45717bc32 100644 --- a/base16ct/src/error.rs +++ b/base16ct/src/error.rs @@ -25,8 +25,8 @@ impl fmt::Display for Error { #[cfg(feature = "std")] impl std::error::Error for Error {} -impl From for core::fmt::Error { - fn from(_: Error) -> core::fmt::Error { - core::fmt::Error +impl From for fmt::Error { + fn from(_: Error) -> fmt::Error { + fmt::Error } } diff --git a/base16ct/src/upper.rs b/base16ct/src/upper.rs index a747f297c..2b82ce68a 100644 --- a/base16ct/src/upper.rs +++ b/base16ct/src/upper.rs @@ -46,7 +46,7 @@ pub fn encode_string(input: &[u8]) -> String { let res = encode(input, &mut dst).expect("dst length is correct"); debug_assert_eq!(elen, res.len()); - unsafe { crate::String::from_utf8_unchecked(dst) } + unsafe { String::from_utf8_unchecked(dst) } } /// Decode a single nibble of upper hex diff --git a/cms/src/builder.rs b/cms/src/builder.rs index d8affe76c..08fc3bddc 100644 --- a/cms/src/builder.rs +++ b/cms/src/builder.rs @@ -205,7 +205,7 @@ impl<'s> Builder for SignerInfoBuilder<'s> { Some(content) => { let mut hasher = get_hasher(&self.digest_algorithm).ok_or_else(|| { // Unsupported hash algorithm: {}, &self.digest_algorithm.oid.to_string() - x509_cert::builder::Error::from(der::Error::from(ErrorKind::Failed)) + builder::Error::from(der::Error::from(ErrorKind::Failed)) })?; // Only the octets comprising the value of the eContent // OCTET STRING are input to the message digest algorithm, not the tag @@ -284,7 +284,7 @@ impl<'s> Builder for SignerInfoBuilder<'s> { }); let signature_value = - SignatureValue::new(signature.raw_bytes()).map_err(x509_cert::builder::Error::from)?; + SignatureValue::new(signature.raw_bytes()).map_err(builder::Error::from)?; let signature_algorithm = signer.signature_algorithm_identifier()?; diff --git a/pkcs1/src/error.rs b/pkcs1/src/error.rs index 135bcd7d9..ac8f4feaa 100644 --- a/pkcs1/src/error.rs +++ b/pkcs1/src/error.rs @@ -75,18 +75,18 @@ impl From for Error { } #[cfg(feature = "pkcs8")] -impl From for pkcs8::spki::Error { - fn from(err: Error) -> pkcs8::spki::Error { +impl From for spki::Error { + fn from(err: Error) -> spki::Error { match err { - Error::Asn1(e) => pkcs8::spki::Error::Asn1(e), - _ => pkcs8::spki::Error::KeyMalformed, + Error::Asn1(e) => spki::Error::Asn1(e), + _ => spki::Error::KeyMalformed, } } } #[cfg(feature = "pkcs8")] -impl From for Error { - fn from(err: pkcs8::spki::Error) -> Error { +impl From for Error { + fn from(err: spki::Error) -> Error { Error::Pkcs8(pkcs8::Error::PublicKey(err)) } } diff --git a/pkcs1/src/traits.rs b/pkcs1/src/traits.rs index c759b3f67..9276e0b04 100644 --- a/pkcs1/src/traits.rs +++ b/pkcs1/src/traits.rs @@ -171,7 +171,7 @@ where #[cfg(feature = "pkcs8")] impl DecodeRsaPublicKey for T where - T: for<'a> TryFrom, Error = pkcs8::spki::Error>, + T: for<'a> TryFrom, Error = spki::Error>, { fn from_pkcs1_der(public_key: &[u8]) -> Result { Ok(Self::try_from(pkcs8::SubjectPublicKeyInfoRef { diff --git a/pkcs5/src/pbes1.rs b/pkcs5/src/pbes1.rs index 025e2a53d..f68f485e4 100644 --- a/pkcs5/src/pbes1.rs +++ b/pkcs5/src/pbes1.rs @@ -93,8 +93,8 @@ impl<'a> TryFrom> for Algorithm { fn try_from(alg: AlgorithmIdentifierRef<'a>) -> der::Result { // Ensure that we have a supported PBES1 algorithm identifier - let encryption = EncryptionScheme::try_from(alg.oid) - .map_err(|_| der::Tag::ObjectIdentifier.value_error())?; + let encryption = + EncryptionScheme::try_from(alg.oid).map_err(|_| Tag::ObjectIdentifier.value_error())?; let parameters = alg .parameters @@ -157,7 +157,7 @@ impl TryFrom> for Parameters { salt: OctetStringRef::decode(reader)? .as_bytes() .try_into() - .map_err(|_| der::Tag::OctetString.value_error())?, + .map_err(|_| Tag::OctetString.value_error())?, iteration_count: reader.decode()?, }) }) diff --git a/pkcs5/src/pbes2.rs b/pkcs5/src/pbes2.rs index a84ff3005..d7b63b8f4 100644 --- a/pkcs5/src/pbes2.rs +++ b/pkcs5/src/pbes2.rs @@ -391,31 +391,25 @@ impl TryFrom> for EncryptionScheme { match alg.oid { AES_128_CBC_OID => Ok(Self::Aes128Cbc { - iv: iv - .try_into() - .map_err(|_| der::Tag::OctetString.value_error())?, + iv: iv.try_into().map_err(|_| Tag::OctetString.value_error())?, }), AES_192_CBC_OID => Ok(Self::Aes192Cbc { - iv: iv - .try_into() - .map_err(|_| der::Tag::OctetString.value_error())?, + iv: iv.try_into().map_err(|_| Tag::OctetString.value_error())?, }), AES_256_CBC_OID => Ok(Self::Aes256Cbc { - iv: iv - .try_into() - .map_err(|_| der::Tag::OctetString.value_error())?, + iv: iv.try_into().map_err(|_| Tag::OctetString.value_error())?, }), #[cfg(feature = "des-insecure")] DES_CBC_OID => Ok(Self::DesCbc { iv: iv[0..DES_BLOCK_SIZE] .try_into() - .map_err(|_| der::Tag::OctetString.value_error())?, + .map_err(|_| Tag::OctetString.value_error())?, }), #[cfg(feature = "3des")] DES_EDE3_CBC_OID => Ok(Self::DesEde3Cbc { iv: iv[0..DES_BLOCK_SIZE] .try_into() - .map_err(|_| der::Tag::OctetString.value_error())?, + .map_err(|_| Tag::OctetString.value_error())?, }), oid => Err(ErrorKind::OidUnknown { oid }.into()), } diff --git a/sec1/src/private_key.rs b/sec1/src/private_key.rs index dacb808f6..b1c832350 100644 --- a/sec1/src/private_key.rs +++ b/sec1/src/private_key.rs @@ -100,7 +100,7 @@ impl<'a> DecodeValue<'a> for EcPrivateKey<'a> { fn decode_value>(reader: &mut R, header: Header) -> der::Result { reader.read_nested(header.length, |reader| { if u8::decode(reader)? != VERSION { - return Err(der::Tag::Integer.value_error()); + return Err(Tag::Integer.value_error()); } let private_key = OctetStringRef::decode(reader)?.as_bytes();