diff --git a/.github/workflows/workspace.yml b/.github/workflows/workspace.yml index 78608f233..39f59a4a1 100644 --- a/.github/workflows/workspace.yml +++ b/.github/workflows/workspace.yml @@ -21,9 +21,9 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: - toolchain: 1.71.0 + toolchain: 1.73.0 components: clippy - - run: cargo clippy --all-features + - run: cargo clippy --all --all-features --tests doc: runs-on: ubuntu-latest diff --git a/cms/tests/builder.rs b/cms/tests/builder.rs index 10e0bf8f8..3273829d0 100644 --- a/cms/tests/builder.rs +++ b/cms/tests/builder.rs @@ -344,7 +344,7 @@ fn test_build_pkcs7_scep_pkcsreq() { values: message_type_value, }; let mut sender_nonce_value: SetOfVec = Default::default(); - let nonce = OctetString::new(*&[42; 32]).unwrap(); + let nonce = OctetString::new([42; 32]).unwrap(); sender_nonce_value .insert(Any::new(Tag::OctetString, nonce.as_bytes()).unwrap()) .unwrap(); diff --git a/cms/tests/compressed_data.rs b/cms/tests/compressed_data.rs index 5d569fea8..28fe016bc 100644 --- a/cms/tests/compressed_data.rs +++ b/cms/tests/compressed_data.rs @@ -40,10 +40,7 @@ fn reencode_compressed_data_test() { // assemble a new ContentInfo and encode it let ci2 = ContentInfo { content_type: ci.content_type, - content: AnyRef::try_from(reencoded_data.as_slice()) - .unwrap() - .try_into() - .unwrap(), + content: AnyRef::try_from(reencoded_data.as_slice()).unwrap().into(), }; let reencoded_data_inci = ci2.to_der().unwrap(); diff --git a/cms/tests/digested_data.rs b/cms/tests/digested_data.rs index e4187d7f0..76338beb7 100644 --- a/cms/tests/digested_data.rs +++ b/cms/tests/digested_data.rs @@ -44,10 +44,7 @@ fn reencode_digested_data_test() { // assemble a new ContentInfo and encode it let ci2 = ContentInfo { content_type: ci.content_type, - content: AnyRef::try_from(reencoded_data.as_slice()) - .unwrap() - .try_into() - .unwrap(), + content: AnyRef::try_from(reencoded_data.as_slice()).unwrap().into(), }; let reencoded_data_inci = ci2.to_der().unwrap(); diff --git a/cms/tests/encrypted_data.rs b/cms/tests/encrypted_data.rs index c710d3426..27d1d56b7 100644 --- a/cms/tests/encrypted_data.rs +++ b/cms/tests/encrypted_data.rs @@ -46,10 +46,7 @@ fn reencode_encrypted_data_test() { // assemble a new ContentInfo and encode it let ci2 = ContentInfo { content_type: ci.content_type, - content: AnyRef::try_from(reencoded_data.as_slice()) - .unwrap() - .try_into() - .unwrap(), + content: AnyRef::try_from(reencoded_data.as_slice()).unwrap().into(), }; let reencoded_data_inci = ci2.to_der().unwrap(); diff --git a/cms/tests/enveloped_data.rs b/cms/tests/enveloped_data.rs index 8d2886213..9cd7019e8 100644 --- a/cms/tests/enveloped_data.rs +++ b/cms/tests/enveloped_data.rs @@ -79,10 +79,7 @@ fn reencode_enveloped_data_ktri_test() { // assemble a new ContentInfo and encode it let ci2 = ContentInfo { content_type: ci.content_type, - content: AnyRef::try_from(reencoded_data.as_slice()) - .unwrap() - .try_into() - .unwrap(), + content: AnyRef::try_from(reencoded_data.as_slice()).unwrap().into(), }; let reencoded_data_in_ci = ci2.to_der().unwrap(); @@ -180,10 +177,7 @@ fn reencode_enveloped_data_kari_test() { // assemble a new ContentInfo and encode it let ci2 = ContentInfo { content_type: ci.content_type, - content: AnyRef::try_from(reencoded_data.as_slice()) - .unwrap() - .try_into() - .unwrap(), + content: AnyRef::try_from(reencoded_data.as_slice()).unwrap().into(), }; let reencoded_data_in_ci = ci2.to_der().unwrap(); @@ -270,10 +264,7 @@ fn reencode_enveloped_data_pwri_test() { // assemble a new ContentInfo and encode it let ci2 = ContentInfo { content_type: ci.content_type, - content: AnyRef::try_from(reencoded_data.as_slice()) - .unwrap() - .try_into() - .unwrap(), + content: AnyRef::try_from(reencoded_data.as_slice()).unwrap().into(), }; let reencoded_data_in_ci = ci2.to_der().unwrap(); @@ -336,10 +327,7 @@ fn reencode_enveloped_data_kek_test() { // assemble a new ContentInfo and encode it let ci2 = ContentInfo { content_type: ci.content_type, - content: AnyRef::try_from(reencoded_data.as_slice()) - .unwrap() - .try_into() - .unwrap(), + content: AnyRef::try_from(reencoded_data.as_slice()).unwrap().into(), }; let reencoded_data_in_ci = ci2.to_der().unwrap(); @@ -498,10 +486,7 @@ fn reencode_enveloped_data_multi_test() { // assemble a new ContentInfo and encode it let ci2 = ContentInfo { content_type: ci.content_type, - content: AnyRef::try_from(reencoded_data.as_slice()) - .unwrap() - .try_into() - .unwrap(), + content: AnyRef::try_from(reencoded_data.as_slice()).unwrap().into(), }; let reencoded_data_in_ci = ci2.to_der().unwrap(); diff --git a/cms/tests/signed_data.rs b/cms/tests/signed_data.rs index efe0dae4a..35c97e3ec 100644 --- a/cms/tests/signed_data.rs +++ b/cms/tests/signed_data.rs @@ -32,8 +32,7 @@ fn trust_list_test() { content_type: ci.content_type, content: AnyRef::try_from(reencoded_signed_data.as_slice()) .unwrap() - .try_into() - .unwrap(), + .into(), }; let reencoded_der_signed_data_in_ci = ci2.to_der().unwrap(); @@ -62,8 +61,7 @@ fn reencode_signed_data_test() { content_type: ci.content_type, content: AnyRef::try_from(reencoded_signed_data.as_slice()) .unwrap() - .try_into() - .unwrap(), + .into(), }; let reencoded_der_signed_data_in_ci = ci2.to_der().unwrap(); diff --git a/cms/tests/tests_from_pkcs7_crate.rs b/cms/tests/tests_from_pkcs7_crate.rs index 8c75adf05..af5c34dc3 100644 --- a/cms/tests/tests_from_pkcs7_crate.rs +++ b/cms/tests/tests_from_pkcs7_crate.rs @@ -71,8 +71,7 @@ fn cms_decode_signed_mdm_example() { content_type: ci.content_type, content: AnyRef::try_from(reencoded_signed_data.as_slice()) .unwrap() - .try_into() - .unwrap(), + .into(), }; let reencoded_der_signed_data_in_ci = ci2.to_der().unwrap(); @@ -99,8 +98,7 @@ fn cms_decode_signed_scep_example() { content_type: ci.content_type, content: AnyRef::try_from(reencoded_signed_data.as_slice()) .unwrap() - .try_into() - .unwrap(), + .into(), }; let reencoded_der_signed_data_in_ci = ci2.to_der().unwrap(); @@ -137,8 +135,7 @@ fn cms_decode_signed_der() { content_type: ci.content_type, content: AnyRef::try_from(reencoded_signed_data.as_slice()) .unwrap() - .try_into() - .unwrap(), + .into(), }; let reencoded_der_signed_data_in_ci = ci2.to_der().unwrap(); diff --git a/pkcs12/tests/cert_tests.rs b/pkcs12/tests/cert_tests.rs index c5d744714..0f3b0b4bd 100644 --- a/pkcs12/tests/cert_tests.rs +++ b/pkcs12/tests/cert_tests.rs @@ -166,7 +166,7 @@ fn decode_sample_pfx() { let auth_safes = AuthenticatedSafe::from_der(auth_safes_os.as_bytes()).unwrap(); // Process first auth safe (from offset 34) - let auth_safe0 = auth_safes.get(0).unwrap(); + let auth_safe0 = auth_safes.first().unwrap(); assert_eq!(ID_ENCRYPTED_DATA, auth_safe0.content_type); let enc_data_os = &auth_safe0.content.to_der().unwrap(); let enc_data = EncryptedData::from_der(enc_data_os.as_slice()).unwrap(); @@ -183,11 +183,11 @@ fn decode_sample_pfx() { let params = pkcs8::pkcs5::pbes2::Parameters::from_der(&enc_params).unwrap(); - let scheme = pkcs5::EncryptionScheme::try_from(params.clone()).unwrap(); + let scheme = pkcs5::EncryptionScheme::from(params.clone()); let ciphertext_os = enc_data.enc_content_info.encrypted_content.clone().unwrap(); let mut ciphertext = ciphertext_os.as_bytes().to_vec(); let plaintext = scheme.decrypt_in_place("", &mut ciphertext).unwrap(); - let cert_bags = SafeContents::from_der(&plaintext).unwrap(); + let cert_bags = SafeContents::from_der(plaintext).unwrap(); for cert_bag in cert_bags { match cert_bag.bag_id { pkcs12::PKCS_12_CERT_BAG_OID => { @@ -589,7 +589,7 @@ fn decode_sample_pfx2() { let auth_safes = AuthenticatedSafe::from_der(auth_safes_os.as_bytes()).unwrap(); // Process first auth safe (from offset 34) - let auth_safe0 = auth_safes.get(0).unwrap(); + let auth_safe0 = auth_safes.first().unwrap(); assert_eq!(ID_DATA, auth_safe0.content_type); let auth_safe0_auth_safes_os = diff --git a/pkcs5/src/pbes2/kdf.rs b/pkcs5/src/pbes2/kdf.rs index 63378cbcb..4c666b658 100644 --- a/pkcs5/src/pbes2/kdf.rs +++ b/pkcs5/src/pbes2/kdf.rs @@ -355,11 +355,11 @@ impl<'a> From for AlgorithmIdentifierRef<'a> { impl Encode for Pbkdf2Prf { fn encoded_len(&self) -> der::Result { - AlgorithmIdentifierRef::try_from(*self)?.encoded_len() + AlgorithmIdentifierRef::from(*self).encoded_len() } fn encode(&self, writer: &mut impl Writer) -> der::Result<()> { - AlgorithmIdentifierRef::try_from(*self)?.encode(writer) + AlgorithmIdentifierRef::from(*self).encode(writer) } } diff --git a/tls_codec/derive/tests/decode.rs b/tls_codec/derive/tests/decode.rs index d0907b25c..feb487341 100644 --- a/tls_codec/derive/tests/decode.rs +++ b/tls_codec/derive/tests/decode.rs @@ -568,7 +568,7 @@ mod conditional_deserialization { let undeserializable_struct = UndeserializableExampleStruct { a: 1, b: 2 }; let serialized = undeserializable_struct.tls_serialize_detached().unwrap(); let deserializable_struct = - DeserializableExampleStruct::tls_deserialize_exact(&mut &*serialized).unwrap(); + DeserializableExampleStruct::tls_deserialize_exact(&*serialized).unwrap(); assert_eq!(deserializable_struct.a, undeserializable_struct.a); assert_eq!(deserializable_struct.b, undeserializable_struct.b); } diff --git a/x509-cert/tests/pkix_extensions.rs b/x509-cert/tests/pkix_extensions.rs index a20e9394d..9d9973a0a 100644 --- a/x509-cert/tests/pkix_extensions.rs +++ b/x509-cert/tests/pkix_extensions.rs @@ -402,7 +402,7 @@ fn decode_cert() { 0 => match dpn { DistributionPointName::FullName(gns) => { assert_eq!(1, gns.len()); - let gn = gns.get(0).unwrap(); + let gn = gns.first().unwrap(); match gn { GeneralName::UniformResourceIdentifier(uri) => { assert_eq!( @@ -422,7 +422,7 @@ fn decode_cert() { 1 => match dpn { DistributionPointName::FullName(gns) => { assert_eq!(1, gns.len()); - let gn = gns.get(0).unwrap(); + let gn = gns.first().unwrap(); match gn { GeneralName::UniformResourceIdentifier(uri) => { assert_eq!("ldap://ldap-pte.identrust.com.test/cn%3DIGC%20Root%20CA1%2Co%3DIdenTrust%2Cc%3DUS%3FcertificateRevocationList%3Bbinary", uri.to_string()); @@ -869,7 +869,7 @@ fn decode_idp() { let gns = GeneralNames::from_der(&hex!("305EA45C305A310B3009060355040613025553311F301D060355040A131654657374204365727469666963617465732032303137311C301A060355040B13136F6E6C79536F6D65526561736F6E7320434133310C300A0603550403130343524C")).unwrap(); assert_eq!(1, gns.len()); - if let GeneralName::DirectoryName(gn) = gns.get(0).unwrap() { + if let GeneralName::DirectoryName(gn) = gns.first().unwrap() { assert_eq!(4, gn.0.len()); } @@ -894,7 +894,7 @@ fn decode_idp() { DistributionPoint::from_der(&hex!("3062A060A05EA45C305A310B3009060355040613025553311F301D060355040A131654657374204365727469666963617465732032303137311C301A060355040B13136F6E6C79536F6D65526561736F6E7320434133310C300A0603550403130343524C")).unwrap(); if let DistributionPointName::FullName(dpn) = dp.distribution_point.unwrap() { assert_eq!(1, dpn.len()); - if let GeneralName::DirectoryName(gn) = dpn.get(0).unwrap() { + if let GeneralName::DirectoryName(gn) = dpn.first().unwrap() { assert_eq!(4, gn.0.len()); } }