diff --git a/benches/bench1.rs b/benches/bench1.rs index c07b8e3d9..ea527cd35 100644 --- a/benches/bench1.rs +++ b/benches/bench1.rs @@ -1,8 +1,6 @@ #![feature(test)] #![allow(unused_imports)] -#![allow( - clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal, clippy::many_single_char_names -)] +#![allow(clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal)] extern crate test; diff --git a/benches/construct.rs b/benches/construct.rs index 380d87799..71a4fb905 100644 --- a/benches/construct.rs +++ b/benches/construct.rs @@ -1,7 +1,5 @@ #![feature(test)] -#![allow( - clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal, clippy::many_single_char_names -)] +#![allow(clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal)] extern crate test; use test::Bencher; diff --git a/benches/gemv_gemm.rs b/benches/gemv_gemm.rs index 2d1642623..ccd987250 100644 --- a/benches/gemv_gemm.rs +++ b/benches/gemv_gemm.rs @@ -1,7 +1,5 @@ #![feature(test)] -#![allow( - clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal, clippy::many_single_char_names -)] +#![allow(clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal)] extern crate test; use test::Bencher; diff --git a/benches/higher-order.rs b/benches/higher-order.rs index 1b4e8340c..5eb009566 100644 --- a/benches/higher-order.rs +++ b/benches/higher-order.rs @@ -1,7 +1,5 @@ #![feature(test)] -#![allow( - clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal, clippy::many_single_char_names -)] +#![allow(clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal)] extern crate test; use test::black_box; use test::Bencher; diff --git a/benches/iter.rs b/benches/iter.rs index 154ee4eaf..bc483c8c2 100644 --- a/benches/iter.rs +++ b/benches/iter.rs @@ -1,7 +1,5 @@ #![feature(test)] -#![allow( - clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal, clippy::many_single_char_names -)] +#![allow(clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal)] extern crate test; use rawpointer::PointerExt; @@ -416,7 +414,7 @@ fn iter_axis_chunks_5_iter_sum(bench: &mut Bencher) pub fn zip_mut_with(data: &Array3, out: &mut Array3) { - out.zip_mut_with(&data, |o, &i| { + out.zip_mut_with(data, |o, &i| { *o = i; }); } diff --git a/benches/par_rayon.rs b/benches/par_rayon.rs index 1301ae75a..95b514278 100644 --- a/benches/par_rayon.rs +++ b/benches/par_rayon.rs @@ -54,7 +54,7 @@ fn fastexp(x: f64) -> f64 fn map_fastexp_regular(bench: &mut Bencher) { let mut a = Array2::::zeros((FASTEXP, FASTEXP)); - bench.iter(|| a.mapv_inplace(|x| fastexp(x))); + bench.iter(|| a.mapv_inplace(fastexp)); } #[bench] @@ -72,7 +72,7 @@ fn map_fastexp_cut(bench: &mut Bencher) { let mut a = Array2::::zeros((FASTEXP, FASTEXP)); let mut a = a.slice_mut(s![.., ..-1]); - bench.iter(|| a.mapv_inplace(|x| fastexp(x))); + bench.iter(|| a.mapv_inplace(fastexp)); } #[bench] diff --git a/examples/axis_ops.rs b/examples/axis_ops.rs index 7f80a637f..0469747f3 100644 --- a/examples/axis_ops.rs +++ b/examples/axis_ops.rs @@ -1,6 +1,4 @@ -#![allow( - clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal, clippy::many_single_char_names -)] +#![allow(clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal)] use ndarray::prelude::*; diff --git a/examples/bounds_check_elim.rs b/examples/bounds_check_elim.rs index f1a91cca0..ef20e9ad2 100644 --- a/examples/bounds_check_elim.rs +++ b/examples/bounds_check_elim.rs @@ -1,7 +1,5 @@ #![crate_type = "lib"] -#![allow( - clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal, clippy::many_single_char_names -)] +#![allow(clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal)] // Test cases for bounds check elimination @@ -57,7 +55,6 @@ pub fn test1d_single_mut(a: &mut Array1, i: usize) -> f64 #[no_mangle] pub fn test1d_len_of(a: &Array1) -> f64 { - let a = a; let mut sum = 0.; for i in 0..a.len_of(Axis(0)) { sum += a[i]; diff --git a/examples/functions_and_traits.rs b/examples/functions_and_traits.rs index 9710a9ff5..7091a5e17 100644 --- a/examples/functions_and_traits.rs +++ b/examples/functions_and_traits.rs @@ -74,8 +74,8 @@ fn takes_base(arr: &ArrayBase) // We can also pass it to functions that accept `RawRef` and `LayoutRef` // in the usual two ways: - takes_rawref(&arr); - takes_layout(&arr); + takes_rawref(arr); + takes_layout(arr); // takes_rawref_asref(&arr); takes_layout_asref(&arr); diff --git a/examples/life.rs b/examples/life.rs index 7db384678..a521f34c4 100644 --- a/examples/life.rs +++ b/examples/life.rs @@ -1,6 +1,4 @@ -#![allow( - clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal, clippy::many_single_char_names -)] +#![allow(clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal)] use ndarray::prelude::*; diff --git a/examples/type_conversion.rs b/examples/type_conversion.rs index cfcd7e564..722991d48 100644 --- a/examples/type_conversion.rs +++ b/examples/type_conversion.rs @@ -34,7 +34,7 @@ fn main() // can be guaranteed to be lossless at compile time. This is the safest // approach. let a_u8: Array = array![[1, 2, 3], [4, 5, 6]]; - let a_f32 = a_u8.mapv(|element| f32::from(element)); + let a_f32 = a_u8.mapv(f32::from); assert_abs_diff_eq!(a_f32, array![[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]); // Fallible, lossless conversion with `TryFrom` diff --git a/examples/zip_many.rs b/examples/zip_many.rs index 57d66a956..944194130 100644 --- a/examples/zip_many.rs +++ b/examples/zip_many.rs @@ -1,6 +1,4 @@ -#![allow( - clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal, clippy::many_single_char_names -)] +#![allow(clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal)] use ndarray::prelude::*; use ndarray::Zip; diff --git a/ndarray-rand/tests/tests.rs b/ndarray-rand/tests/tests.rs index 5d322551a..b1a80e5e6 100644 --- a/ndarray-rand/tests/tests.rs +++ b/ndarray-rand/tests/tests.rs @@ -128,7 +128,7 @@ fn sampling_works(a: &Array2, strategy: SamplingStrategy, axis: Axis, n_sam // Check if, when sliced along `axis`, there is at least one lane in `a` equal to `b` fn is_subset(a: &Array2, b: &ArrayView1, axis: Axis) -> bool { - a.axis_iter(axis).any(|lane| &lane == b) + a.axis_iter(axis).any(|lane| lane == b) } #[test] diff --git a/src/dimension/broadcast.rs b/src/dimension/broadcast.rs index 9e7474388..8fb445cb8 100644 --- a/src/dimension/broadcast.rs +++ b/src/dimension/broadcast.rs @@ -111,7 +111,7 @@ mod tests D1: Dimension + DimMax, D2: Dimension, { - let d = co_broadcast::>::Output>(&d1, d2); + let d = co_broadcast::>::Output>(d1, d2); assert_eq!(d, r); } test_co(&Dim([2, 3]), &Dim([4, 1, 3]), Ok(Dim([4, 2, 3]))); diff --git a/src/dimension/mod.rs b/src/dimension/mod.rs index 4ada0b127..68f625115 100644 --- a/src/dimension/mod.rs +++ b/src/dimension/mod.rs @@ -850,17 +850,17 @@ mod test #[test] fn max_abs_offset_check_overflow_examples() { - let dim = (1, ::std::isize::MAX as usize, 1).into_dimension(); + let dim = (1, isize::MAX as usize, 1).into_dimension(); let strides = (1, 1, 1).into_dimension(); max_abs_offset_check_overflow::(&dim, &strides).unwrap(); - let dim = (1, ::std::isize::MAX as usize, 2).into_dimension(); + let dim = (1, isize::MAX as usize, 2).into_dimension(); let strides = (1, 1, 1).into_dimension(); max_abs_offset_check_overflow::(&dim, &strides).unwrap_err(); let dim = (0, 2, 2).into_dimension(); - let strides = (1, ::std::isize::MAX as usize, 1).into_dimension(); + let strides = (1, isize::MAX as usize, 1).into_dimension(); max_abs_offset_check_overflow::(&dim, &strides).unwrap_err(); let dim = (0, 2, 2).into_dimension(); - let strides = (1, ::std::isize::MAX as usize / 4, 1).into_dimension(); + let strides = (1, isize::MAX as usize / 4, 1).into_dimension(); max_abs_offset_check_overflow::(&dim, &strides).unwrap_err(); } diff --git a/src/linalg/impl_linalg.rs b/src/linalg/impl_linalg.rs index 14c82ff4d..7dfe98578 100644 --- a/src/linalg/impl_linalg.rs +++ b/src/linalg/impl_linalg.rs @@ -435,12 +435,12 @@ where A: LinalgScalar { let cblas_layout = c_layout.to_cblas_layout(); let a_trans = a_layout.to_cblas_transpose_for(cblas_layout); - let lda = blas_stride(&a, a_layout); + let lda = blas_stride(a, a_layout); let b_trans = b_layout.to_cblas_transpose_for(cblas_layout); - let ldb = blas_stride(&b, b_layout); + let ldb = blas_stride(b, b_layout); - let ldc = blas_stride(&c, c_layout); + let ldc = blas_stride(c, c_layout); macro_rules! gemm_scalar_cast { (f32, $var:ident) => { diff --git a/src/tri.rs b/src/tri.rs index 9f15db71a..1e10c3b6a 100644 --- a/src/tri.rs +++ b/src/tri.rs @@ -159,8 +159,6 @@ where #[cfg(test)] mod tests { - use core::isize; - use crate::{array, dimension, Array0, Array1, Array2, Array3, ShapeBuilder}; use alloc::vec; diff --git a/tests/append.rs b/tests/append.rs index cf5397de1..40beb0f92 100644 --- a/tests/append.rs +++ b/tests/append.rs @@ -255,14 +255,14 @@ fn append_array_3d() let aa = array![[[51, 52], [53, 54]], [[55, 56], [57, 58]]]; let av = aa.view(); println!("Send {:?} to append", av); - a.append(Axis(0), av.clone()).unwrap(); + a.append(Axis(0), av).unwrap(); a.swap_axes(0, 1); let aa = array![[[71, 72], [73, 74]], [[75, 76], [77, 78]]]; let mut av = aa.view(); av.swap_axes(0, 1); println!("Send {:?} to append", av); - a.append(Axis(1), av.clone()).unwrap(); + a.append(Axis(1), av).unwrap(); println!("{:?}", a); let aa = array![[[81, 82], [83, 84]], [[85, 86], [87, 88]]]; let mut av = aa.view(); @@ -304,7 +304,7 @@ fn test_append_2d() println!("{:?}", a); assert_eq!(a.shape(), &[8, 4]); for (i, row) in a.rows().into_iter().enumerate() { - let ones = i < 3 || i >= 5; + let ones = !(3..5).contains(&i); assert!(row.iter().all(|&x| x == ones as i32 as f64), "failed on lane {}", i); } @@ -319,7 +319,7 @@ fn test_append_2d() assert_eq!(a.shape(), &[4, 8]); for (i, row) in a.columns().into_iter().enumerate() { - let ones = i < 3 || i >= 5; + let ones = !(3..5).contains(&i); assert!(row.iter().all(|&x| x == ones as i32 as f64), "failed on lane {}", i); } } diff --git a/tests/array-construct.rs b/tests/array-construct.rs index 9f8418467..ec8cedf3f 100644 --- a/tests/array-construct.rs +++ b/tests/array-construct.rs @@ -1,6 +1,4 @@ -#![allow( - clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal, clippy::many_single_char_names -)] +#![allow(clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal)] use defmac::defmac; use ndarray::arr3; diff --git a/tests/array.rs b/tests/array.rs index 6512043b2..512227bb6 100644 --- a/tests/array.rs +++ b/tests/array.rs @@ -1,7 +1,6 @@ #![allow(non_snake_case)] #![allow( - clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal, clippy::many_single_char_names, - clippy::float_cmp + clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal, clippy::float_cmp )] use approx::assert_relative_eq; @@ -1006,7 +1005,7 @@ fn iter_size_hint() fn zero_axes() { let mut a = arr1::(&[]); - for _ in a.iter() { + if let Some(_) = a.iter().next() { panic!(); } a.map(|_| panic!()); @@ -1112,12 +1111,12 @@ fn as_slice_memory_order_mut_contiguous_cowarray() #[test] fn to_slice_memory_order() { - for shape in vec![[2, 0, 3, 5], [2, 1, 3, 5], [2, 4, 3, 5]] { + for shape in [[2, 0, 3, 5], [2, 1, 3, 5], [2, 4, 3, 5]] { let data: Vec = (0..shape.iter().product()).collect(); let mut orig = Array1::from(data.clone()) .into_shape_with_order(shape) .unwrap(); - for perm in vec![[0, 1, 2, 3], [0, 2, 1, 3], [2, 0, 1, 3]] { + for perm in [[0, 1, 2, 3], [0, 2, 1, 3], [2, 0, 1, 3]] { let mut a = orig.view_mut().permuted_axes(perm); assert_eq!(a.as_slice_memory_order().unwrap(), &data); assert_eq!(a.as_slice_memory_order_mut().unwrap(), &data); @@ -2173,7 +2172,7 @@ fn test_contiguous_neg_strides() assert_eq!(f, arr3(&[[[11], [9]], [[10], [8]]])); assert!(f.as_slice_memory_order().is_some()); - let mut g = b.clone(); + let mut g = b; g.collapse_axis(Axis(1), 0); assert_eq!(g, arr3(&[[[11, 7, 3]], [[10, 6, 2]]])); assert!(g.as_slice_memory_order().is_none()); @@ -2568,7 +2567,7 @@ mod array_cow_tests fn run_with_various_layouts(mut f: impl FnMut(Array2)) { - for all in vec![ + for all in [ Array2::from_shape_vec((7, 8), (0..7 * 8).collect()).unwrap(), Array2::from_shape_vec((7, 8).f(), (0..7 * 8).collect()).unwrap(), ] { diff --git a/tests/azip.rs b/tests/azip.rs index 9d8bebab7..d10476207 100644 --- a/tests/azip.rs +++ b/tests/azip.rs @@ -1,6 +1,5 @@ #![allow( - clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal, clippy::many_single_char_names, - clippy::float_cmp + clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal, clippy::float_cmp )] use ndarray::prelude::*; @@ -138,17 +137,11 @@ fn test_zip_collect_drop() { fn a_is_f(self) -> bool { - match self { - Config::CC | Config::CF => false, - _ => true, - } + !matches!(self, Config::CC | Config::CF) } fn b_is_f(self) -> bool { - match self { - Config::CC => false, - _ => true, - } + !matches!(self, Config::CC) } } diff --git a/tests/into-ixdyn.rs b/tests/into-ixdyn.rs index 6e7bf9607..410ce92b5 100644 --- a/tests/into-ixdyn.rs +++ b/tests/into-ixdyn.rs @@ -1,6 +1,5 @@ #![allow( - clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal, clippy::many_single_char_names, - clippy::float_cmp + clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal, clippy::float_cmp )] use ndarray::prelude::*; diff --git a/tests/iterator_chunks.rs b/tests/iterator_chunks.rs index c16d8bc81..d46482937 100644 --- a/tests/iterator_chunks.rs +++ b/tests/iterator_chunks.rs @@ -1,6 +1,5 @@ #![allow( - clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal, clippy::many_single_char_names, - clippy::float_cmp + clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal, clippy::float_cmp )] use ndarray::prelude::*; diff --git a/tests/iterators.rs b/tests/iterators.rs index 9890e05a7..e8933a823 100644 --- a/tests/iterators.rs +++ b/tests/iterators.rs @@ -29,7 +29,7 @@ fn double_ended() assert_eq!(it.next(), Some(0)); assert_eq!(it.next_back(), Some(7)); assert_eq!(it.next(), Some(1)); - assert_eq!(it.rev().last(), Some(2)); + assert_eq!(it.rev().next_back(), Some(2)); assert_equal(aview1(&[1, 2, 3]), &[1, 2, 3]); assert_equal(aview1(&[1, 2, 3]).into_iter().rev(), [1, 2, 3].iter().rev()); } @@ -1058,7 +1058,7 @@ fn test_impl_iter_compiles() // Requires that the iterators are covariant in the element type // base case: std - fn slice_iter_non_empty_indices<'s, 'a>(array: &'a Vec<&'s str>) -> impl Iterator + 'a + fn slice_iter_non_empty_indices<'a>(array: &'a Vec<&str>) -> impl Iterator + 'a { array .iter() @@ -1070,7 +1070,7 @@ fn test_impl_iter_compiles() let _ = slice_iter_non_empty_indices; // ndarray case - fn array_iter_non_empty_indices<'s, 'a>(array: &'a Array<&'s str, Ix1>) -> impl Iterator + 'a + fn array_iter_non_empty_indices<'a>(array: &'a Array<&str, Ix1>) -> impl Iterator + 'a { array .iter() diff --git a/tests/ix0.rs b/tests/ix0.rs index f1038556a..319de39e3 100644 --- a/tests/ix0.rs +++ b/tests/ix0.rs @@ -1,6 +1,5 @@ #![allow( - clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal, clippy::many_single_char_names, - clippy::float_cmp + clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal, clippy::float_cmp )] use ndarray::Array; diff --git a/tests/ixdyn.rs b/tests/ixdyn.rs index f14df9f0e..517975145 100644 --- a/tests/ixdyn.rs +++ b/tests/ixdyn.rs @@ -1,6 +1,5 @@ #![allow( - clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal, clippy::many_single_char_names, - clippy::float_cmp + clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal, clippy::float_cmp )] use ndarray::Array; diff --git a/tests/numeric.rs b/tests/numeric.rs index 7e6964812..11a9fce76 100644 --- a/tests/numeric.rs +++ b/tests/numeric.rs @@ -1,6 +1,5 @@ #![allow( - clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal, clippy::many_single_char_names, - clippy::float_cmp + clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal, clippy::float_cmp )] use approx::assert_abs_diff_eq; @@ -176,7 +175,7 @@ fn var_too_large_ddof() fn var_nan_ddof() { let a = Array2::::zeros((2, 3)); - let v = a.var(::std::f64::NAN); + let v = a.var(std::f64::NAN); assert!(v.is_nan()); } @@ -219,7 +218,7 @@ fn std_too_large_ddof() fn std_nan_ddof() { let a = Array2::::zeros((2, 3)); - let v = a.std(::std::f64::NAN); + let v = a.std(f64::NAN); assert!(v.is_nan()); } @@ -344,7 +343,7 @@ fn std_axis() ); assert_abs_diff_eq!( b.std_axis(Axis(1), 0.), - aview1(&[47140.214021552769]), + aview1(&[47_140.214_021_552_77]), epsilon = 1e-6, ); @@ -375,7 +374,7 @@ fn var_axis_too_large_ddof() fn var_axis_nan_ddof() { let a = Array2::::zeros((2, 3)); - let v = a.var_axis(Axis(1), ::std::f64::NAN); + let v = a.var_axis(Axis(1), f64::NAN); assert_eq!(v.shape(), &[2]); v.mapv(|x| assert!(x.is_nan())); } diff --git a/tests/oper.rs b/tests/oper.rs index 0751c0c13..4f68d27d3 100644 --- a/tests/oper.rs +++ b/tests/oper.rs @@ -1,6 +1,4 @@ -#![allow( - clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal, clippy::many_single_char_names -)] +#![allow(clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal)] use ndarray::linalg::general_mat_mul; use ndarray::linalg::kron; use ndarray::prelude::*; @@ -148,18 +146,16 @@ fn dot_product() assert_abs_diff_eq!(a2.dot(&b2), reference_dot(&a2, &b2), epsilon = 1e-5); } - let a = a.map(|f| *f as f32); - let b = b.map(|f| *f as f32); assert_abs_diff_eq!(a.dot(&b), dot as f32, epsilon = 1e-5); let max = 8 as Ixs; for i in 1..max { let a1 = a.slice(s![i..]); let b1 = b.slice(s![i..]); - assert_abs_diff_eq!(a1.dot(&b1), reference_dot(&a1, &b1), epsilon = 1e-5); + assert_abs_diff_eq!(a1.dot(&b1), reference_dot(a1, b1), epsilon = 1e-5); let a2 = a.slice(s![..-i]); let b2 = b.slice(s![i..]); - assert_abs_diff_eq!(a2.dot(&b2), reference_dot(&a2, &b2), epsilon = 1e-5); + assert_abs_diff_eq!(a2.dot(&b2), reference_dot(a2, b2), epsilon = 1e-5); } let a = a.map(|f| *f as i32); @@ -175,17 +171,17 @@ fn dot_product_0() let x = 1.5; let b = aview0(&x); let b = b.broadcast(a.dim()).unwrap(); - assert_abs_diff_eq!(a.dot(&b), reference_dot(&a, &b), epsilon = 1e-5); + assert_abs_diff_eq!(a.dot(&b), reference_dot(&a, b), epsilon = 1e-5); // test different alignments let max = 8 as Ixs; for i in 1..max { let a1 = a.slice(s![i..]); let b1 = b.slice(s![i..]); - assert_abs_diff_eq!(a1.dot(&b1), reference_dot(&a1, &b1), epsilon = 1e-5); + assert_abs_diff_eq!(a1.dot(&b1), reference_dot(a1, b1), epsilon = 1e-5); let a2 = a.slice(s![..-i]); let b2 = b.slice(s![i..]); - assert_abs_diff_eq!(a2.dot(&b2), reference_dot(&a2, &b2), epsilon = 1e-5); + assert_abs_diff_eq!(a2.dot(&b2), reference_dot(a2, b2), epsilon = 1e-5); } } @@ -199,13 +195,13 @@ fn dot_product_neg_stride() // both negative let a = a.slice(s![..;stride]); let b = b.slice(s![..;stride]); - assert_abs_diff_eq!(a.dot(&b), reference_dot(&a, &b), epsilon = 1e-5); + assert_abs_diff_eq!(a.dot(&b), reference_dot(a, b), epsilon = 1e-5); } for stride in -10..0 { // mixed let a = a.slice(s![..;-stride]); let b = b.slice(s![..;stride]); - assert_abs_diff_eq!(a.dot(&b), reference_dot(&a, &b), epsilon = 1e-5); + assert_abs_diff_eq!(a.dot(&b), reference_dot(a, b), epsilon = 1e-5); } } @@ -598,8 +594,10 @@ fn scaled_add_3() #[test] fn gen_mat_mul() { + use core::f64; + let alpha = -2.3; - let beta = 3.14; + let beta = f64::consts::PI; let sizes = vec![ (4, 4, 4), (8, 8, 8), @@ -687,6 +685,8 @@ fn gen_mat_mul_i32() #[cfg_attr(miri, ignore)] // Takes too long fn gen_mat_vec_mul() { + use core::f64; + use approx::assert_relative_eq; use ndarray::linalg::general_mat_vec_mul; @@ -709,7 +709,7 @@ fn gen_mat_vec_mul() } let alpha = -2.3; - let beta = 3.14; + let beta = f64::consts::PI; let sizes = vec![ (4, 4), (8, 8), diff --git a/tests/s.rs b/tests/s.rs index edb3f071a..27e009ebc 100644 --- a/tests/s.rs +++ b/tests/s.rs @@ -1,6 +1,4 @@ -#![allow( - clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal, clippy::many_single_char_names -)] +#![allow(clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal)] use ndarray::{s, Array}; diff --git a/tests/windows.rs b/tests/windows.rs index 4d4d0d7d7..7d0f36990 100644 --- a/tests/windows.rs +++ b/tests/windows.rs @@ -1,6 +1,4 @@ -#![allow( - clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal, clippy::many_single_char_names -)] +#![allow(clippy::many_single_char_names, clippy::deref_addrof, clippy::unreadable_literal)] use ndarray::prelude::*; use ndarray::{arr3, Zip};