From 75555c5c5e0b912d586ace8fbb3dd69b16c3b222 Mon Sep 17 00:00:00 2001 From: Adam Reichold Date: Sun, 14 Apr 2024 11:56:05 +0200 Subject: [PATCH] Silence non_local_definition warnings until they fixed upstream in PyO3's macros --- examples/linalg/src/lib.rs | 2 ++ examples/parallel/src/lib.rs | 2 ++ examples/simple/src/lib.rs | 2 ++ tests/array.rs | 1 + tests/borrow.rs | 1 + tests/to_py.rs | 4 ++-- 6 files changed, 10 insertions(+), 2 deletions(-) diff --git a/examples/linalg/src/lib.rs b/examples/linalg/src/lib.rs index 729c965e7..87e921652 100755 --- a/examples/linalg/src/lib.rs +++ b/examples/linalg/src/lib.rs @@ -1,3 +1,5 @@ +#![allow(non_local_definitions)] + use ndarray_linalg::solve::Inverse; use numpy::{IntoPyArray, PyArray2, PyReadonlyArray2}; use pyo3::{exceptions::PyRuntimeError, pymodule, types::PyModule, Bound, PyResult, Python}; diff --git a/examples/parallel/src/lib.rs b/examples/parallel/src/lib.rs index 20a04d331..5af05c185 100755 --- a/examples/parallel/src/lib.rs +++ b/examples/parallel/src/lib.rs @@ -1,3 +1,5 @@ +#![allow(non_local_definitions)] + // We need to link `blas_src` directly, c.f. https://github.com/rust-ndarray/ndarray#how-to-enable-blas-integration extern crate blas_src; diff --git a/examples/simple/src/lib.rs b/examples/simple/src/lib.rs index 33c61557a..5cc2f884f 100644 --- a/examples/simple/src/lib.rs +++ b/examples/simple/src/lib.rs @@ -1,3 +1,5 @@ +#![allow(non_local_definitions)] + use std::ops::Add; use numpy::ndarray::{Array1, ArrayD, ArrayView1, ArrayViewD, ArrayViewMutD, Zip}; diff --git a/tests/array.rs b/tests/array.rs index b6bf22ea1..71103f491 100644 --- a/tests/array.rs +++ b/tests/array.rs @@ -400,6 +400,7 @@ fn dtype_via_python_attribute() { } #[test] +#[allow(non_local_definitions)] fn borrow_from_array_works() { #[pyclass] struct Owner { diff --git a/tests/borrow.rs b/tests/borrow.rs index 761aae6e5..272356613 100644 --- a/tests/borrow.rs +++ b/tests/borrow.rs @@ -87,6 +87,7 @@ fn exclusive_borrow_requires_writeable() { #[test] #[should_panic(expected = "AlreadyBorrowed")] +#[allow(non_local_definitions)] fn borrows_span_frames() { #[pyclass] struct Borrower; diff --git a/tests/to_py.rs b/tests/to_py.rs index f5ebe0c55..a68ae38e0 100644 --- a/tests/to_py.rs +++ b/tests/to_py.rs @@ -79,12 +79,12 @@ fn from_small_array() { ($($t:ty)+) => { $({ Python::with_gil(|py| { - let array: [$t; 2] = [<$t>::min_value(), <$t>::max_value()]; + let array: [$t; 2] = [<$t>::MIN, <$t>::MAX]; let pyarray = array.to_pyarray_bound(py); assert_eq!( pyarray.readonly().as_slice().unwrap(), - &[<$t>::min_value(), <$t>::max_value()] + &[<$t>::MIN, <$t>::MAX] ); }); })+