diff --git a/src/rust/cryptography-x509/src/extensions.rs b/src/rust/cryptography-x509/src/extensions.rs index 2191bc1da16c..41c36e3b77f0 100644 --- a/src/rust/cryptography-x509/src/extensions.rs +++ b/src/rust/cryptography-x509/src/extensions.rs @@ -47,9 +47,7 @@ impl<'a> Extensions<'a> { /// Retrieves the extension identified by the given OID, /// or None if the extension is not present (or no extensions are present). pub fn get_extension(&self, oid: &asn1::ObjectIdentifier) -> Option { - self.0 - .as_ref() - .and_then(|exts| exts.unwrap_read().clone().find(|ext| &ext.extn_id == oid)) + self.iter().find(|ext| &ext.extn_id == oid) } /// Returns a reference to the underlying extensions.