From f5debb139de73f28eb424117250519caa0c18127 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Thu, 22 Feb 2024 22:29:34 -0500 Subject: [PATCH] Simplify implementation of repr on OIDs --- src/rust/src/oid.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/rust/src/oid.rs b/src/rust/src/oid.rs index 4bf764eee408..7996895ca1f0 100644 --- a/src/rust/src/oid.rs +++ b/src/rust/src/oid.rs @@ -41,17 +41,12 @@ impl ObjectIdentifier { slf } - fn __repr__(&self, py: pyo3::Python<'_>) -> pyo3::PyResult { - let self_clone = pyo3::PyCell::new( - py, - ObjectIdentifier { - oid: self.oid.clone(), - }, - )?; - let name = ObjectIdentifier::_name(self_clone.borrow(), py)?.extract::<&str>()?; + fn __repr__(slf: &pyo3::PyCell, py: pyo3::Python<'_>) -> pyo3::PyResult { + let name = Self::_name(slf.borrow(), py)?.extract::<&str>()?; Ok(format!( "", - self.oid, name + slf.get().oid, + name )) }