Skip to content

Commit 050b656

Browse files
authored
Remove various pointless borrows (#12026)
1 parent d3403c0 commit 050b656

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

src/rust/cryptography-x509-verification/src/policy/extension.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ mod tests {
592592
critical: bool,
593593
ext: &T,
594594
) -> Vec<u8> {
595-
let ext_value = asn1::write_single(&ext).unwrap();
595+
let ext_value = asn1::write_single(ext).unwrap();
596596
let ext = Extension {
597597
extn_id: oid,
598598
critical,

src/rust/cryptography-x509-verification/src/policy/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ mod tests {
680680
assert!(WEBPKI_PERMITTED_SIGNATURE_ALGORITHMS.contains(&RSASSA_PSS_SHA256.deref()));
681681
let exp_encoding = b"0A\x06\t*\x86H\x86\xf7\r\x01\x01\n04\xa0\x0f0\r\x06\t`\x86H\x01e\x03\x04\x02\x01\x05\x00\xa1\x1c0\x1a\x06\t*\x86H\x86\xf7\r\x01\x01\x080\r\x06\t`\x86H\x01e\x03\x04\x02\x01\x05\x00\xa2\x03\x02\x01 ";
682682
assert_eq!(
683-
asn1::write_single(&RSASSA_PSS_SHA256.deref()).unwrap(),
683+
asn1::write_single(RSASSA_PSS_SHA256.deref()).unwrap(),
684684
exp_encoding
685685
);
686686
}
@@ -689,7 +689,7 @@ mod tests {
689689
assert!(WEBPKI_PERMITTED_SIGNATURE_ALGORITHMS.contains(&RSASSA_PSS_SHA384.deref()));
690690
let exp_encoding = b"0A\x06\t*\x86H\x86\xf7\r\x01\x01\n04\xa0\x0f0\r\x06\t`\x86H\x01e\x03\x04\x02\x02\x05\x00\xa1\x1c0\x1a\x06\t*\x86H\x86\xf7\r\x01\x01\x080\r\x06\t`\x86H\x01e\x03\x04\x02\x02\x05\x00\xa2\x03\x02\x010";
691691
assert_eq!(
692-
asn1::write_single(&RSASSA_PSS_SHA384.deref()).unwrap(),
692+
asn1::write_single(RSASSA_PSS_SHA384.deref()).unwrap(),
693693
exp_encoding
694694
);
695695
}
@@ -698,7 +698,7 @@ mod tests {
698698
assert!(WEBPKI_PERMITTED_SIGNATURE_ALGORITHMS.contains(&RSASSA_PSS_SHA512.deref()));
699699
let exp_encoding = b"0A\x06\t*\x86H\x86\xf7\r\x01\x01\n04\xa0\x0f0\r\x06\t`\x86H\x01e\x03\x04\x02\x03\x05\x00\xa1\x1c0\x1a\x06\t*\x86H\x86\xf7\r\x01\x01\x080\r\x06\t`\x86H\x01e\x03\x04\x02\x03\x05\x00\xa2\x03\x02\x01@";
700700
assert_eq!(
701-
asn1::write_single(&RSASSA_PSS_SHA512.deref()).unwrap(),
701+
asn1::write_single(RSASSA_PSS_SHA512.deref()).unwrap(),
702702
exp_encoding
703703
);
704704
}

src/rust/src/pkcs7.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,9 @@ fn sign_and_serialize<'p>(
190190
// Subset of values OpenSSL provides:
191191
// https://github.com/openssl/openssl/blob/667a8501f0b6e5705fd611d5bb3ca24848b07154/crypto/pkcs7/pk7_smime.c#L150
192192
// removing all the ones that are bad cryptography
193-
&asn1::SequenceOfWriter::new([oid::AES_256_CBC_OID]),
194-
&asn1::SequenceOfWriter::new([oid::AES_192_CBC_OID]),
195-
&asn1::SequenceOfWriter::new([oid::AES_128_CBC_OID]),
193+
asn1::SequenceOfWriter::new([oid::AES_256_CBC_OID]),
194+
asn1::SequenceOfWriter::new([oid::AES_192_CBC_OID]),
195+
asn1::SequenceOfWriter::new([oid::AES_128_CBC_OID]),
196196
]))?;
197197

198198
#[allow(clippy::type_complexity)]

src/rust/src/x509/certificate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ impl Certificate {
9393
py: pyo3::Python<'p>,
9494
algorithm: &pyo3::Bound<'p, pyo3::PyAny>,
9595
) -> CryptographyResult<pyo3::Bound<'p, pyo3::types::PyBytes>> {
96-
let serialized = asn1::write_single(&self.raw.borrow_dependent())?;
96+
let serialized = asn1::write_single(self.raw.borrow_dependent())?;
9797

9898
let mut h = hashes::Hash::new(py, algorithm, None)?;
9999
h.update_bytes(&serialized)?;

src/rust/src/x509/crl.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ pub(crate) struct CertificateRevocationList {
9393

9494
impl CertificateRevocationList {
9595
fn public_bytes_der(&self) -> CryptographyResult<Vec<u8>> {
96-
Ok(asn1::write_single(&self.owned.borrow_dependent())?)
96+
Ok(asn1::write_single(self.owned.borrow_dependent())?)
9797
}
9898

9999
fn revoked_cert(&self, py: pyo3::Python<'_>, idx: usize) -> RevokedCertificate {
@@ -239,7 +239,7 @@ impl CertificateRevocationList {
239239
py: pyo3::Python<'p>,
240240
encoding: pyo3::Bound<'p, pyo3::PyAny>,
241241
) -> CryptographyResult<pyo3::Bound<'p, pyo3::types::PyBytes>> {
242-
let result = asn1::write_single(&self.owned.borrow_dependent())?;
242+
let result = asn1::write_single(self.owned.borrow_dependent())?;
243243

244244
encode_der_data(py, "X509 CRL".to_string(), result, &encoding)
245245
}

0 commit comments

Comments
 (0)