diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb7e90adb..37c7df0c7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -262,7 +262,7 @@ jobs: with: python-version: "3.12" - name: Install Rust - uses: dtolnay/rust-toolchain@1.63 + uses: dtolnay/rust-toolchain@1.74 - uses: Swatinem/rust-cache@v2 with: workspaces: examples/simple @@ -273,8 +273,6 @@ jobs: run: | import toml cargo_toml = toml.load("Cargo.toml") - cargo_toml["dependencies"]["ndarray"] = "0.15.6" - cargo_toml["dependencies"]["once_cell"] = "1.20.3" with open("Cargo.toml", "w") as f: toml.dump(cargo_toml, f) working-directory: examples/simple @@ -289,10 +287,6 @@ jobs: cargo_lock = toml.load("Cargo.lock") for pkg in cargo_lock["package"]: pkg_id = pkg["name"] + ":" + pkg["version"] - if pkg["name"] == "ndarray" and pkg["version"] != "0.15.6": - subprocess.run(["cargo", "update", "--package", pkg_id, "--precise", "0.15.6"], check=True) - elif pkg["name"] == "once_cell" and pkg["version"] != "1.20.3": - subprocess.run(["cargo", "update", "--package", pkg_id, "--precise", "1.20.3"], check=True) working-directory: examples/simple shell: python - name: Test example diff --git a/CHANGELOG.md b/CHANGELOG.md index 938674bb7..65723179d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,13 @@ # Changelog +- v0.26.0 + - bump MSRV to 1.74, matching PyO3 ([#504](https://github.com/PyO3/rust-numpy/pull/504)) + +- v0.25.0, + - Bump PyO3 dependency to v0.25.0. ([#492](https://github.com/PyO3/rust-numpy/pull/492)) + - v0.24.0 - - Bump PyO3 dependency to v0.24.0. ([#483](https://github.com/PyO3/rust-numpy/pull/483) - - Support Python 3.13t "free-threaded" Python. ([#471](https://github.com/PyO3/rust-numpy/pull/471) + - Bump PyO3 dependency to v0.24.0. ([#483](https://github.com/PyO3/rust-numpy/pull/483)) + - Support Python 3.13t "free-threaded" Python. ([#471](https://github.com/PyO3/rust-numpy/pull/471)) - v0.23.0 - Drop support for PyPy 3.7 and 3.8. ([#470](https://github.com/PyO3/rust-numpy/pull/470)) diff --git a/Cargo.toml b/Cargo.toml index ec359edd3..8a5273781 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ authors = [ description = "PyO3-based Rust bindings of the NumPy C-API" documentation = "https://docs.rs/numpy" edition = "2021" -rust-version = "1.63" +rust-version = "1.74" repository = "https://github.com/PyO3/rust-numpy" categories = ["api-bindings", "development-tools::ffi", "science"] keywords = ["python", "numpy", "ffi", "pyo3"] diff --git a/src/array.rs b/src/array.rs index 6d5ad222f..b7623e862 100644 --- a/src/array.rs +++ b/src/array.rs @@ -756,6 +756,7 @@ pub trait PyArrayMethods<'py, T, D>: PyUntypedArrayMethods<'py> { /// or concurrently modified by Python or other native code. /// /// Please consider the safe alternative [`PyReadwriteArray::as_slice_mut`]. + #[allow(clippy::mut_from_ref)] unsafe fn as_slice_mut(&self) -> Result<&mut [T], NotContiguousError> where T: Element, @@ -821,6 +822,7 @@ pub trait PyArrayMethods<'py, T, D>: PyUntypedArrayMethods<'py> { /// assert_eq!(unsafe { *pyarray.get([1, 0, 3]).unwrap() }, 42); /// }); /// ``` + #[allow(clippy::mut_from_ref)] unsafe fn get_mut(&self, index: impl NpyIndex) -> Option<&mut T> where T: Element, diff --git a/src/borrow/mod.rs b/src/borrow/mod.rs index de709c193..dd6846678 100644 --- a/src/borrow/mod.rs +++ b/src/borrow/mod.rs @@ -674,7 +674,7 @@ mod tests { let shared = array.readonly(); assert_eq!( - format!("{:?}", shared), + format!("{shared:?}"), "PyReadonlyArray>" ); } @@ -683,7 +683,7 @@ mod tests { let exclusive = array.readwrite(); assert_eq!( - format!("{:?}", exclusive), + format!("{exclusive:?}"), "PyReadwriteArray>" ); } diff --git a/src/borrow/shared.rs b/src/borrow/shared.rs index 939098c64..9f8d1fb6d 100644 --- a/src/borrow/shared.rs +++ b/src/borrow/shared.rs @@ -151,8 +151,7 @@ fn insert_shared<'py>(py: Python<'py>) -> PyResult<*const Shared> { let version = unsafe { *capsule.pointer().cast::() }; if version < 1 { return Err(PyTypeError::new_err(format!( - "Version {} of borrow checking API is not supported by this version of rust-numpy", - version + "Version {version} of borrow checking API is not supported by this version of rust-numpy" ))); } @@ -175,7 +174,7 @@ pub fn acquire<'py>(py: Python<'py>, array: *mut PyArrayObject) -> Result<(), Bo match rc { 0 => Ok(()), -1 => Err(BorrowError::AlreadyBorrowed), - rc => panic!("Unexpected return code {} from borrow checking API", rc), + rc => panic!("Unexpected return code {rc} from borrow checking API"), } } @@ -188,7 +187,7 @@ pub fn acquire_mut<'py>(py: Python<'py>, array: *mut PyArrayObject) -> Result<() 0 => Ok(()), -1 => Err(BorrowError::AlreadyBorrowed), -2 => Err(BorrowError::NotWriteable), - rc => panic!("Unexpected return code {} from borrow checking API", rc), + rc => panic!("Unexpected return code {rc} from borrow checking API"), } } diff --git a/src/dtype.rs b/src/dtype.rs index ee497f672..5c65f60e7 100644 --- a/src/dtype.rs +++ b/src/dtype.rs @@ -510,7 +510,7 @@ fn npy_int_type_lookup(npy_types: [NPY_TYPES; 3]) -> NPY_TYPES { x if x == size_of::() => npy_types[0], x if x == size_of::() => npy_types[1], x if x == size_of::() => npy_types[2], - _ => panic!("Unable to match integer type descriptor: {:?}", npy_types), + _ => panic!("Unable to match integer type descriptor: {npy_types:?}"), } } diff --git a/src/npyffi/array.rs b/src/npyffi/array.rs index 55fe64ded..045cee49a 100644 --- a/src/npyffi/array.rs +++ b/src/npyffi/array.rs @@ -46,7 +46,7 @@ pub(crate) fn mod_name(py: Python<'_>) -> PyResult<&'static str> { MOD_NAME .get_or_try_init(py, || { let numpy_core = numpy_core_name(py)?; - Ok(format!("{}.multiarray", numpy_core)) + Ok(format!("{numpy_core}.multiarray")) }) .map(String::as_str) } diff --git a/src/npyffi/ufunc.rs b/src/npyffi/ufunc.rs index 729a85f52..ef677cc52 100644 --- a/src/npyffi/ufunc.rs +++ b/src/npyffi/ufunc.rs @@ -11,7 +11,7 @@ fn mod_name(py: Python<'_>) -> PyResult<&'static str> { MOD_NAME .get_or_try_init(py, || { let numpy_core = super::array::numpy_core_name(py)?; - Ok(format!("{}.umath", numpy_core)) + Ok(format!("{numpy_core}.umath")) }) .map(String::as_str) }