From 4225c6278ae142242141480e7bac4be36a884d66 Mon Sep 17 00:00:00 2001 From: akern40 Date: Sun, 18 Oct 2026 17:52:55 +0000 Subject: [PATCH] fix(ci): address new lints and float constant deprecations Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- README-quick-start.md | 3 +-- src/indexes.rs | 5 +---- src/iterators/mod.rs | 10 ++-------- src/lib.rs | 1 - tests/numeric.rs | 1 - 5 files changed, 4 insertions(+), 16 deletions(-) diff --git a/README-quick-start.md b/README-quick-start.md index 84e968744..8aef36609 100644 --- a/README-quick-start.md +++ b/README-quick-start.md @@ -108,7 +108,6 @@ Basic operations on arrays are all element-wise; you need to use specific method ```rust use ndarray::prelude::*; use ndarray::Array; -use std::f64::INFINITY as inf; fn main() { let a = array![ @@ -119,7 +118,7 @@ fn main() { assert_eq!(&a + &b, array![[10., 21., 32., 43.,]]); // Allocates a new array. Note the explicit `&`. assert_eq!(&a - &b, array![[10., 19., 28., 37.,]]); assert_eq!(&a * &b, array![[0., 20., 60., 120.,]]); - assert_eq!(&a / &b, array![[inf, 20., 15., 13.333333333333334,]]); + assert_eq!(&a / &b, array![[f64::INFINITY, 20., 15., 13.333333333333334,]]); } ``` diff --git a/src/indexes.rs b/src/indexes.rs index 0fa2b50fb..74982f6d5 100644 --- a/src/indexes.rs +++ b/src/indexes.rs @@ -57,10 +57,7 @@ where D: Dimension #[inline] fn next(&mut self) -> Option { - let index = match self.index { - None => return None, - Some(ref ix) => ix.clone(), - }; + let index = self.index.clone()?; self.index = self.dim.next_for(index.clone()); Some(index.into_pattern()) } diff --git a/src/iterators/mod.rs b/src/iterators/mod.rs index abca3579d..a18542d20 100644 --- a/src/iterators/mod.rs +++ b/src/iterators/mod.rs @@ -512,10 +512,7 @@ impl<'a, A, D: Dimension> Iterator for IndexedIter<'a, A, D> #[inline] fn next(&mut self) -> Option { - let index = match self.0.inner.index { - None => return None, - Some(ref ix) => ix.clone(), - }; + let index = self.0.inner.index.clone()?; match self.0.next() { None => None, Some(elem) => Some((index.into_pattern(), elem)), @@ -695,10 +692,7 @@ impl<'a, A, D: Dimension> Iterator for IndexedIterMut<'a, A, D> #[inline] fn next(&mut self) -> Option { - let index = match self.0.inner.index { - None => return None, - Some(ref ix) => ix.clone(), - }; + let index = self.0.inner.index.clone()?; match self.0.next() { None => None, Some(elem) => Some((index.into_pattern(), elem)), diff --git a/src/lib.rs b/src/lib.rs index 57674acb3..98f04bd4c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -13,7 +13,6 @@ clippy::deref_addrof, clippy::manual_map, // is not an error clippy::while_let_on_iterator, // is not an error - clippy::from_iter_instead_of_collect, // using from_iter is good style clippy::incompatible_msrv, // false positive PointerExt::offset )] #![doc(test(attr(deny(warnings))))] diff --git a/tests/numeric.rs b/tests/numeric.rs index b82a3561f..247fab931 100644 --- a/tests/numeric.rs +++ b/tests/numeric.rs @@ -4,7 +4,6 @@ use approx::assert_abs_diff_eq; use ndarray::{arr0, arr1, arr2, array, aview1, Array, Array1, Array2, Array3, Axis}; -use std::f64; #[test] fn test_mean_with_nan_values()