From 63e4cf268bf4b9e367b198b3e696ed06b3cb9592 Mon Sep 17 00:00:00 2001 From: Julian Hofer Date: Fri, 8 Sep 2023 10:54:44 +0200 Subject: [PATCH] Remove unneeded lifetime annotations --- examples/linalg/src/lib.rs | 4 ++-- examples/parallel/src/lib.rs | 6 +++--- examples/simple/src/lib.rs | 18 +++++++++--------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/examples/linalg/src/lib.rs b/examples/linalg/src/lib.rs index 0ea9a635d..7b0b20a5e 100755 --- a/examples/linalg/src/lib.rs +++ b/examples/linalg/src/lib.rs @@ -3,9 +3,9 @@ use numpy::{IntoPyArray, PyArray2, PyReadonlyArray2}; use pyo3::{exceptions::PyRuntimeError, pymodule, types::PyModule, PyResult, Python}; #[pymodule] -fn rust_linalg(_py: Python<'_>, m: &PyModule) -> PyResult<()> { +fn rust_linalg(_py: Python, m: &PyModule) -> PyResult<()> { #[pyfn(m)] - fn inv<'py>(py: Python<'py>, x: PyReadonlyArray2<'py, f64>) -> PyResult<&'py PyArray2> { + fn inv<'py>(py: Python<'py>, x: PyReadonlyArray2) -> PyResult<&'py PyArray2> { let x = x.as_array(); let y = x .inv() diff --git a/examples/parallel/src/lib.rs b/examples/parallel/src/lib.rs index 5ed72b865..cc20dc039 100755 --- a/examples/parallel/src/lib.rs +++ b/examples/parallel/src/lib.rs @@ -6,12 +6,12 @@ use numpy::{IntoPyArray, PyArray1, PyReadonlyArray1, PyReadonlyArray2}; use pyo3::{pymodule, types::PyModule, PyResult, Python}; #[pymodule] -fn rust_parallel(_py: Python<'_>, m: &PyModule) -> PyResult<()> { +fn rust_parallel(_py: Python, m: &PyModule) -> PyResult<()> { #[pyfn(m)] fn rows_dot<'py>( py: Python<'py>, - x: PyReadonlyArray2<'py, f64>, - y: PyReadonlyArray1<'py, f64>, + x: PyReadonlyArray2, + y: PyReadonlyArray1, ) -> &'py PyArray1 { let x = x.as_array(); let y = y.as_array(); diff --git a/examples/simple/src/lib.rs b/examples/simple/src/lib.rs index 57a0e06a8..cdd4d9b6a 100644 --- a/examples/simple/src/lib.rs +++ b/examples/simple/src/lib.rs @@ -14,26 +14,26 @@ use pyo3::{ }; #[pymodule] -fn rust_ext(_py: Python<'_>, m: &PyModule) -> PyResult<()> { +fn rust_ext(_py: Python, m: &PyModule) -> PyResult<()> { // example using generic PyObject - fn head(x: ArrayViewD<'_, PyObject>) -> PyResult { + fn head(x: ArrayViewD) -> PyResult { x.get(0) .cloned() .ok_or_else(|| PyIndexError::new_err("array index out of range")) } // example using immutable borrows producing a new array - fn axpy(a: f64, x: ArrayViewD<'_, f64>, y: ArrayViewD<'_, f64>) -> ArrayD { + fn axpy(a: f64, x: ArrayViewD, y: ArrayViewD) -> ArrayD { a * &x + &y } // example using a mutable borrow to modify an array in-place - fn mult(a: f64, mut x: ArrayViewMutD<'_, f64>) { + fn mult(a: f64, mut x: ArrayViewMutD) { x *= a; } // example using complex numbers - fn conj(x: ArrayViewD<'_, Complex64>) -> ArrayD { + fn conj(x: ArrayViewD) -> ArrayD { x.map(|c| c.conj()) } @@ -45,7 +45,7 @@ fn rust_ext(_py: Python<'_>, m: &PyModule) -> PyResult<()> { // wrapper of `head` #[pyfn(m)] #[pyo3(name = "head")] - fn head_py(_py: Python<'_>, x: PyReadonlyArrayDyn<'_, PyObject>) -> PyResult { + fn head_py(_py: Python, x: PyReadonlyArrayDyn) -> PyResult { head(x.as_array()) } @@ -55,8 +55,8 @@ fn rust_ext(_py: Python<'_>, m: &PyModule) -> PyResult<()> { fn axpy_py<'py>( py: Python<'py>, a: f64, - x: PyReadonlyArrayDyn<'_, f64>, - y: PyReadonlyArrayDyn<'_, f64>, + x: PyReadonlyArrayDyn, + y: PyReadonlyArrayDyn, ) -> &'py PyArrayDyn { let x = x.as_array(); let y = y.as_array(); @@ -77,7 +77,7 @@ fn rust_ext(_py: Python<'_>, m: &PyModule) -> PyResult<()> { #[pyo3(name = "conj")] fn conj_py<'py>( py: Python<'py>, - x: PyReadonlyArrayDyn<'_, Complex64>, + x: PyReadonlyArrayDyn, ) -> &'py PyArrayDyn { conj(x.as_array()).into_pyarray(py) }