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 )) }