From 609f8024bc0ba20d885cb391bd043b28538cf1a8 Mon Sep 17 00:00:00 2001 From: Lorenzo Mec-iS Date: Mon, 20 Jan 2025 15:23:36 +0000 Subject: [PATCH] more clippy fixes --- src/algorithm/neighbour/fastpair.rs | 2 +- src/linalg/basic/matrix.rs | 3 ++- src/linalg/traits/stats.rs | 1 - src/svm/svc.rs | 2 +- src/svm/svr.rs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/algorithm/neighbour/fastpair.rs b/src/algorithm/neighbour/fastpair.rs index 9f663f6..671517d 100644 --- a/src/algorithm/neighbour/fastpair.rs +++ b/src/algorithm/neighbour/fastpair.rs @@ -212,7 +212,7 @@ mod tests_fastpair { use crate::linalg::basic::{arrays::Array, matrix::DenseMatrix}; /// Brute force algorithm, used only for comparison and testing - pub fn closest_pair_brute(fastpair: &FastPair>) -> PairwiseDistance { + pub fn closest_pair_brute(fastpair: &FastPair<'_, f64, DenseMatrix>) -> PairwiseDistance { use itertools::Itertools; let m = fastpair.samples.shape().0; diff --git a/src/linalg/basic/matrix.rs b/src/linalg/basic/matrix.rs index 4be6a2d..979e5a5 100644 --- a/src/linalg/basic/matrix.rs +++ b/src/linalg/basic/matrix.rs @@ -142,7 +142,7 @@ impl<'a, T: Debug + Display + Copy + Sized> DenseMatrixMutView<'a, T> { } } - fn iter_mut<'b>(&'b mut self, axis: u8) -> Box + 'b> { + fn iter_mut<'b>(&'b mut self, axis: u8) -> Box + 'b> { let column_major = self.column_major; let stride = self.stride; let ptr = self.values.as_mut_ptr(); @@ -604,6 +604,7 @@ impl MatrixStats for DenseMatrix {} impl MatrixPreprocessing for DenseMatrix {} #[cfg(test)] +#[warn(clippy::reversed_empty_ranges)] mod tests { use super::*; use approx::relative_eq; diff --git a/src/linalg/traits/stats.rs b/src/linalg/traits/stats.rs index 8702a81..6c3db82 100644 --- a/src/linalg/traits/stats.rs +++ b/src/linalg/traits/stats.rs @@ -142,7 +142,6 @@ pub trait MatrixPreprocessing: MutArrayView2 + Clone { /// /// assert_eq!(a, expected); /// ``` - fn binarize_mut(&mut self, threshold: T) { let (nrows, ncols) = self.shape(); for row in 0..nrows { diff --git a/src/svm/svc.rs b/src/svm/svc.rs index 67ffdc3..cc5a0be 100644 --- a/src/svm/svc.rs +++ b/src/svm/svc.rs @@ -1110,7 +1110,7 @@ mod tests { let svc = SVC::fit(&x, &y, ¶ms).unwrap(); // serialization - let deserialized_svc: SVC = + let deserialized_svc: SVC<'_, f64, i32, _, _> = serde_json::from_str(&serde_json::to_string(&svc).unwrap()).unwrap(); assert_eq!(svc, deserialized_svc); diff --git a/src/svm/svr.rs b/src/svm/svr.rs index 85b48e4..4ce0aa2 100644 --- a/src/svm/svr.rs +++ b/src/svm/svr.rs @@ -702,7 +702,7 @@ mod tests { let svr = SVR::fit(&x, &y, ¶ms).unwrap(); - let deserialized_svr: SVR, _> = + let deserialized_svr: SVR<'_, f64, DenseMatrix, _> = serde_json::from_str(&serde_json::to_string(&svr).unwrap()).unwrap(); assert_eq!(svr, deserialized_svr);