Skip to content

Commit ca17e88

Browse files
committed
Resolve warnings on non-local definitions and legacy numerical constants.
1 parent 0832b28 commit ca17e88

File tree

3 files changed

+25
-25
lines changed

3 files changed

+25
-25
lines changed

tests/array.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -399,23 +399,23 @@ fn dtype_via_python_attribute() {
399399
});
400400
}
401401

402-
#[test]
403-
fn borrow_from_array_works() {
404-
#[pyclass]
405-
struct Owner {
406-
array: Array1<f64>,
407-
}
402+
#[pyclass]
403+
struct Owner {
404+
array: Array1<f64>,
405+
}
408406

409-
#[pymethods]
410-
impl Owner {
411-
#[getter]
412-
fn array(this: Bound<'_, Self>) -> Bound<'_, PyArray1<f64>> {
413-
let array = &this.borrow().array;
407+
#[pymethods]
408+
impl Owner {
409+
#[getter]
410+
fn array(this: Bound<'_, Self>) -> Bound<'_, PyArray1<f64>> {
411+
let array = &this.borrow().array;
414412

415-
unsafe { PyArray1::borrow_from_array_bound(array, this.into_any()) }
416-
}
413+
unsafe { PyArray1::borrow_from_array_bound(array, this.into_any()) }
417414
}
415+
}
418416

417+
#[test]
418+
fn borrow_from_array_works() {
419419
let array = Python::with_gil(|py| {
420420
let owner = Py::new(
421421
py,

tests/borrow.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,19 +85,19 @@ fn exclusive_borrow_requires_writeable() {
8585
});
8686
}
8787

88-
#[test]
89-
#[should_panic(expected = "AlreadyBorrowed")]
90-
fn borrows_span_frames() {
91-
#[pyclass]
92-
struct Borrower;
88+
#[pyclass]
89+
struct Borrower;
9390

94-
#[pymethods]
95-
impl Borrower {
96-
fn shared(&self, _array: PyReadonlyArray3<'_, f64>) {}
91+
#[pymethods]
92+
impl Borrower {
93+
fn shared(&self, _array: PyReadonlyArray3<'_, f64>) {}
9794

98-
fn exclusive(&self, _array: PyReadwriteArray3<'_, f64>) {}
99-
}
95+
fn exclusive(&self, _array: PyReadwriteArray3<'_, f64>) {}
96+
}
10097

98+
#[test]
99+
#[should_panic(expected = "AlreadyBorrowed")]
100+
fn borrows_span_frames() {
101101
Python::with_gil(|py| {
102102
let borrower = Py::new(py, Borrower).unwrap();
103103

tests/to_py.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@ fn from_small_array() {
7979
($($t:ty)+) => {
8080
$({
8181
Python::with_gil(|py| {
82-
let array: [$t; 2] = [<$t>::min_value(), <$t>::max_value()];
82+
let array: [$t; 2] = [<$t>::MIN, <$t>::MAX];
8383
let pyarray = array.to_pyarray_bound(py);
8484

8585
assert_eq!(
8686
pyarray.readonly().as_slice().unwrap(),
87-
&[<$t>::min_value(), <$t>::max_value()]
87+
&[<$t>::MIN, <$t>::MAX]
8888
);
8989
});
9090
})+

0 commit comments

Comments
 (0)