Skip to content

Commit b6395cf

Browse files
authored
optimize refcounting op in datetime creation (#1590)
1 parent b5c3e14 commit b6395cf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/input/datetime.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub fn pydate_as_date(py_date: &Bound<'_, PyAny>) -> PyResult<Date> {
4848
}
4949

5050
impl<'py> EitherDate<'py> {
51-
pub fn try_into_py(&self, py: Python<'py>, input: &(impl Input<'py> + ?Sized)) -> ValResult<PyObject> {
51+
pub fn try_into_py(self, py: Python<'py>, input: &(impl Input<'py> + ?Sized)) -> ValResult<PyObject> {
5252
match self {
5353
Self::Raw(date) => {
5454
if date.year == 0 {
@@ -63,7 +63,7 @@ impl<'py> EitherDate<'py> {
6363
let py_date = PyDate::new(py, date.year.into(), date.month, date.day)?;
6464
Ok(py_date.into())
6565
}
66-
Self::Py(py_date) => Ok(py_date.clone().into()),
66+
Self::Py(py_date) => Ok(py_date.into()),
6767
}
6868
}
6969

@@ -285,7 +285,7 @@ pub fn pydatetime_as_datetime(py_dt: &Bound<'_, PyAny>) -> PyResult<DateTime> {
285285
}
286286

287287
impl<'py> EitherDateTime<'py> {
288-
pub fn try_into_py(&self, py: Python<'py>, input: &(impl Input<'py> + ?Sized)) -> ValResult<PyObject> {
288+
pub fn try_into_py(self, py: Python<'py>, input: &(impl Input<'py> + ?Sized)) -> ValResult<PyObject> {
289289
match self {
290290
Self::Raw(dt) => {
291291
if dt.date.year == 0 {
@@ -310,7 +310,7 @@ impl<'py> EitherDateTime<'py> {
310310
)?;
311311
Ok(py_dt.into())
312312
}
313-
Self::Py(py_dt) => Ok(py_dt.clone().into()),
313+
Self::Py(py_dt) => Ok(py_dt.into()),
314314
}
315315
}
316316

0 commit comments

Comments
 (0)