From ed6b34a0d6b9ff8661382423df87e30081d78fd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Lauzier?= Date: Sun, 25 Jul 2021 13:06:14 -0400 Subject: [PATCH] Fix rust_2018_idioms warnings --- src/base/array_storage.rs | 4 +- src/base/blas.rs | 6 +-- src/base/matrix.rs | 22 ++++----- src/base/matrix_slice.rs | 64 ++++++++++++------------- src/base/ops.rs | 4 +- src/base/statistics.rs | 6 +-- src/geometry/dual_quaternion.rs | 2 +- src/geometry/isometry.rs | 2 +- src/geometry/orthographic.rs | 2 +- src/geometry/perspective.rs | 2 +- src/geometry/point.rs | 6 +-- src/geometry/quaternion.rs | 8 ++-- src/geometry/quaternion_construction.rs | 2 +- src/geometry/rotation.rs | 2 +- src/geometry/similarity.rs | 2 +- src/geometry/translation.rs | 2 +- src/geometry/unit_complex.rs | 2 +- src/lib.rs | 1 + src/linalg/solve.rs | 16 +++---- 19 files changed, 78 insertions(+), 77 deletions(-) diff --git a/src/base/array_storage.rs b/src/base/array_storage.rs index 643bc631..dc4e0df7 100644 --- a/src/base/array_storage.rs +++ b/src/base/array_storage.rs @@ -49,7 +49,7 @@ where impl Debug for ArrayStorage { #[inline] - fn fmt(&self, fmt: &mut Formatter) -> fmt::Result { + fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result { self.0.fmt(fmt) } } @@ -231,7 +231,7 @@ where { type Value = ArrayStorage; - fn expecting(&self, formatter: &mut Formatter) -> fmt::Result { + fn expecting(&self, formatter: &mut Formatter<'_>) -> fmt::Result { formatter.write_str("a matrix array") } diff --git a/src/base/blas.rs b/src/base/blas.rs index b705c6c1..72b00bda 100644 --- a/src/base/blas.rs +++ b/src/base/blas.rs @@ -455,8 +455,8 @@ where x: &Vector, beta: T, dot: impl Fn( - &DVectorSlice, - &DVectorSlice, + &DVectorSlice<'_, T, SB::RStride, SB::CStride>, + &DVectorSlice<'_, T, SC::RStride, SC::CStride>, ) -> T, ) where T: One, @@ -619,7 +619,7 @@ where a: &Matrix, x: &Vector, beta: T, - dot: impl Fn(&VectorSlice, &Vector) -> T, + dot: impl Fn(&VectorSlice<'_, T, R2, SB::RStride, SB::CStride>, &Vector) -> T, ) where T: One, SB: Storage, diff --git a/src/base/matrix.rs b/src/base/matrix.rs index 319e8eb9..ea2c2c40 100644 --- a/src/base/matrix.rs +++ b/src/base/matrix.rs @@ -193,7 +193,7 @@ pub struct Matrix { } impl fmt::Debug for Matrix { - fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> { + fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { formatter .debug_struct("Matrix") .field("data", &self.data) @@ -278,7 +278,7 @@ impl> matrixcompare_core::Matrix< self.ncols() } - fn access(&self) -> matrixcompare_core::Access { + fn access(&self) -> matrixcompare_core::Access<'_, T> { matrixcompare_core::Access::Dense(self) } } @@ -1051,7 +1051,7 @@ impl> Matrix { /// assert_eq!(*it.next().unwrap(), 23); /// assert!(it.next().is_none()); #[inline] - pub fn iter(&self) -> MatrixIter { + pub fn iter(&self) -> MatrixIter<'_, T, R, C, S> { MatrixIter::new(&self.data) } @@ -1067,7 +1067,7 @@ impl> Matrix { /// } /// ``` #[inline] - pub fn row_iter(&self) -> RowIter { + pub fn row_iter(&self) -> RowIter<'_, T, R, C, S> { RowIter::new(self) } @@ -1082,13 +1082,13 @@ impl> Matrix { /// } /// ``` #[inline] - pub fn column_iter(&self) -> ColumnIter { + pub fn column_iter(&self) -> ColumnIter<'_, T, R, C, S> { ColumnIter::new(self) } /// Mutably iterates through this matrix coordinates. #[inline] - pub fn iter_mut(&mut self) -> MatrixIterMut + pub fn iter_mut(&mut self) -> MatrixIterMut<'_, T, R, C, S> where S: StorageMut, { @@ -1111,7 +1111,7 @@ impl> Matrix { /// assert_eq!(a, expected); /// ``` #[inline] - pub fn row_iter_mut(&mut self) -> RowIterMut + pub fn row_iter_mut(&mut self) -> RowIterMut<'_, T, R, C, S> where S: StorageMut, { @@ -1134,7 +1134,7 @@ impl> Matrix { /// assert_eq!(a, expected); /// ``` #[inline] - pub fn column_iter_mut(&mut self) -> ColumnIterMut + pub fn column_iter_mut(&mut self) -> ColumnIterMut<'_, T, R, C, S> where S: StorageMut, { @@ -1820,9 +1820,9 @@ macro_rules! impl_fmt { T: Scalar + $trait, S: Storage, { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { #[cfg(feature = "std")] - fn val_width(val: &T, f: &mut fmt::Formatter) -> usize { + fn val_width(val: &T, f: &mut fmt::Formatter<'_>) -> usize { match f.precision() { Some(precision) => format!($fmt_str_with_precision, val, precision) .chars() @@ -1832,7 +1832,7 @@ macro_rules! impl_fmt { } #[cfg(not(feature = "std"))] - fn val_width(_: &T, _: &mut fmt::Formatter) -> usize { + fn val_width(_: &T, _: &mut fmt::Formatter<'_>) -> usize { 4 } diff --git a/src/base/matrix_slice.rs b/src/base/matrix_slice.rs index 96ebe59c..bd4a66da 100644 --- a/src/base/matrix_slice.rs +++ b/src/base/matrix_slice.rs @@ -315,20 +315,20 @@ macro_rules! matrix_slice_impl( */ /// Returns a slice containing the i-th row of this matrix. #[inline] - pub fn $row($me: $Me, i: usize) -> $MatrixSlice { + pub fn $row($me: $Me, i: usize) -> $MatrixSlice<'_, T, U1, C, S::RStride, S::CStride> { $me.$fixed_rows::<1>(i) } /// Returns a slice containing the `n` first elements of the i-th row of this matrix. #[inline] - pub fn $row_part($me: $Me, i: usize, n: usize) -> $MatrixSlice { + pub fn $row_part($me: $Me, i: usize, n: usize) -> $MatrixSlice<'_, T, U1, Dynamic, S::RStride, S::CStride> { $me.$generic_slice((i, 0), (Const::<1>, Dynamic::new(n))) } /// Extracts from this matrix a set of consecutive rows. #[inline] pub fn $rows($me: $Me, first_row: usize, nrows: usize) - -> $MatrixSlice { + -> $MatrixSlice<'_, T, Dynamic, C, S::RStride, S::CStride> { $me.$rows_generic(first_row, Dynamic::new(nrows)) } @@ -336,7 +336,7 @@ macro_rules! matrix_slice_impl( /// Extracts from this matrix a set of consecutive rows regularly skipping `step` rows. #[inline] pub fn $rows_with_step($me: $Me, first_row: usize, nrows: usize, step: usize) - -> $MatrixSlice { + -> $MatrixSlice<'_, T, Dynamic, C, Dynamic, S::CStride> { $me.$rows_generic_with_step(first_row, Dynamic::new(nrows), step) } @@ -344,7 +344,7 @@ macro_rules! matrix_slice_impl( /// Extracts a compile-time number of consecutive rows from this matrix. #[inline] pub fn $fixed_rows($me: $Me, first_row: usize) - -> $MatrixSlice, C, S::RStride, S::CStride> { + -> $MatrixSlice<'_, T, Const, C, S::RStride, S::CStride> { $me.$rows_generic(first_row, Const::) } @@ -353,7 +353,7 @@ macro_rules! matrix_slice_impl( /// rows. #[inline] pub fn $fixed_rows_with_step($me: $Me, first_row: usize, step: usize) - -> $MatrixSlice, C, Dynamic, S::CStride> { + -> $MatrixSlice<'_, T, Const, C, Dynamic, S::CStride> { $me.$rows_generic_with_step(first_row, Const::, step) } @@ -362,7 +362,7 @@ macro_rules! matrix_slice_impl( /// argument may or may not be values known at compile-time. #[inline] pub fn $rows_generic($me: $Me, row_start: usize, nrows: RSlice) - -> $MatrixSlice { + -> $MatrixSlice<'_, T, RSlice, C, S::RStride, S::CStride> { let my_shape = $me.data.shape(); $me.assert_slice_index((row_start, 0), (nrows.value(), my_shape.1.value()), (0, 0)); @@ -379,7 +379,7 @@ macro_rules! matrix_slice_impl( /// argument may or may not be values known at compile-time. #[inline] pub fn $rows_generic_with_step($me: $Me, row_start: usize, nrows: RSlice, step: usize) - -> $MatrixSlice + -> $MatrixSlice<'_, T, RSlice, C, Dynamic, S::CStride> where RSlice: Dim { let my_shape = $me.data.shape(); @@ -402,20 +402,20 @@ macro_rules! matrix_slice_impl( */ /// Returns a slice containing the i-th column of this matrix. #[inline] - pub fn $column($me: $Me, i: usize) -> $MatrixSlice { + pub fn $column($me: $Me, i: usize) -> $MatrixSlice<'_, T, R, U1, S::RStride, S::CStride> { $me.$fixed_columns::<1>(i) } /// Returns a slice containing the `n` first elements of the i-th column of this matrix. #[inline] - pub fn $column_part($me: $Me, i: usize, n: usize) -> $MatrixSlice { + pub fn $column_part($me: $Me, i: usize, n: usize) -> $MatrixSlice<'_, T, Dynamic, U1, S::RStride, S::CStride> { $me.$generic_slice((0, i), (Dynamic::new(n), Const::<1>)) } /// Extracts from this matrix a set of consecutive columns. #[inline] pub fn $columns($me: $Me, first_col: usize, ncols: usize) - -> $MatrixSlice { + -> $MatrixSlice<'_, T, R, Dynamic, S::RStride, S::CStride> { $me.$columns_generic(first_col, Dynamic::new(ncols)) } @@ -424,7 +424,7 @@ macro_rules! matrix_slice_impl( /// columns. #[inline] pub fn $columns_with_step($me: $Me, first_col: usize, ncols: usize, step: usize) - -> $MatrixSlice { + -> $MatrixSlice<'_, T, R, Dynamic, S::RStride, Dynamic> { $me.$columns_generic_with_step(first_col, Dynamic::new(ncols), step) } @@ -432,7 +432,7 @@ macro_rules! matrix_slice_impl( /// Extracts a compile-time number of consecutive columns from this matrix. #[inline] pub fn $fixed_columns($me: $Me, first_col: usize) - -> $MatrixSlice, S::RStride, S::CStride> { + -> $MatrixSlice<'_, T, R, Const, S::RStride, S::CStride> { $me.$columns_generic(first_col, Const::) } @@ -441,7 +441,7 @@ macro_rules! matrix_slice_impl( /// `step` columns. #[inline] pub fn $fixed_columns_with_step($me: $Me, first_col: usize, step: usize) - -> $MatrixSlice, S::RStride, Dynamic> { + -> $MatrixSlice<'_, T, R, Const, S::RStride, Dynamic> { $me.$columns_generic_with_step(first_col, Const::, step) } @@ -450,7 +450,7 @@ macro_rules! matrix_slice_impl( /// known at compile-time. #[inline] pub fn $columns_generic($me: $Me, first_col: usize, ncols: CSlice) - -> $MatrixSlice { + -> $MatrixSlice<'_, T, R, CSlice, S::RStride, S::CStride> { let my_shape = $me.data.shape(); $me.assert_slice_index((0, first_col), (my_shape.0.value(), ncols.value()), (0, 0)); @@ -467,7 +467,7 @@ macro_rules! matrix_slice_impl( /// or may not be values known at compile-time. #[inline] pub fn $columns_generic_with_step($me: $Me, first_col: usize, ncols: CSlice, step: usize) - -> $MatrixSlice { + -> $MatrixSlice<'_, T, R, CSlice, S::RStride, Dynamic> { let my_shape = $me.data.shape(); let my_strides = $me.data.strides(); @@ -492,7 +492,7 @@ macro_rules! matrix_slice_impl( /// consecutive elements. #[inline] pub fn $slice($me: $Me, start: (usize, usize), shape: (usize, usize)) - -> $MatrixSlice { + -> $MatrixSlice<'_, T, Dynamic, Dynamic, S::RStride, S::CStride> { $me.assert_slice_index(start, shape, (0, 0)); let shape = (Dynamic::new(shape.0), Dynamic::new(shape.1)); @@ -510,7 +510,7 @@ macro_rules! matrix_slice_impl( /// original matrix. #[inline] pub fn $slice_with_steps($me: $Me, start: (usize, usize), shape: (usize, usize), steps: (usize, usize)) - -> $MatrixSlice { + -> $MatrixSlice<'_, T, Dynamic, Dynamic, Dynamic, Dynamic> { let shape = (Dynamic::new(shape.0), Dynamic::new(shape.1)); $me.$generic_slice_with_steps(start, shape, steps) @@ -520,7 +520,7 @@ macro_rules! matrix_slice_impl( /// CSlice::dim())` consecutive components. #[inline] pub fn $fixed_slice($me: $Me, irow: usize, icol: usize) - -> $MatrixSlice, Const, S::RStride, S::CStride> { + -> $MatrixSlice<'_, T, Const, Const, S::RStride, S::CStride> { $me.assert_slice_index((irow, icol), (RSLICE, CSLICE), (0, 0)); let shape = (Const::, Const::); @@ -537,7 +537,7 @@ macro_rules! matrix_slice_impl( /// the original matrix. #[inline] pub fn $fixed_slice_with_steps($me: $Me, start: (usize, usize), steps: (usize, usize)) - -> $MatrixSlice, Const, Dynamic, Dynamic> { + -> $MatrixSlice<'_, T, Const, Const, Dynamic, Dynamic> { let shape = (Const::, Const::); $me.$generic_slice_with_steps(start, shape, steps) } @@ -545,7 +545,7 @@ macro_rules! matrix_slice_impl( /// Creates a slice that may or may not have a fixed size and stride. #[inline] pub fn $generic_slice($me: $Me, start: (usize, usize), shape: (RSlice, CSlice)) - -> $MatrixSlice + -> $MatrixSlice<'_, T, RSlice, CSlice, S::RStride, S::CStride> where RSlice: Dim, CSlice: Dim { @@ -563,7 +563,7 @@ macro_rules! matrix_slice_impl( start: (usize, usize), shape: (RSlice, CSlice), steps: (usize, usize)) - -> $MatrixSlice + -> $MatrixSlice<'_, T, RSlice, CSlice, Dynamic, Dynamic> where RSlice: Dim, CSlice: Dim { @@ -589,8 +589,8 @@ macro_rules! matrix_slice_impl( /// Panics if the ranges overlap or if the first range is empty. #[inline] pub fn $rows_range_pair, Range2: SliceRange>($me: $Me, r1: Range1, r2: Range2) - -> ($MatrixSlice, - $MatrixSlice) { + -> ($MatrixSlice<'_, T, Range1::Size, C, S::RStride, S::CStride>, + $MatrixSlice<'_, T, Range2::Size, C, S::RStride, S::CStride>) { let (nrows, ncols) = $me.data.shape(); let strides = $me.data.strides(); @@ -625,8 +625,8 @@ macro_rules! matrix_slice_impl( /// Panics if the ranges overlap or if the first range is empty. #[inline] pub fn $columns_range_pair, Range2: SliceRange>($me: $Me, r1: Range1, r2: Range2) - -> ($MatrixSlice, - $MatrixSlice) { + -> ($MatrixSlice<'_, T, R, Range1::Size, S::RStride, S::CStride>, + $MatrixSlice<'_, T, R, Range2::Size, S::RStride, S::CStride>) { let (nrows, ncols) = $me.data.shape(); let strides = $me.data.strides(); @@ -870,7 +870,7 @@ impl> Matrix { &self, rows: RowRange, cols: ColRange, - ) -> MatrixSlice + ) -> MatrixSlice<'_, T, RowRange::Size, ColRange::Size, S::RStride, S::CStride> where RowRange: SliceRange, ColRange: SliceRange, @@ -888,7 +888,7 @@ impl> Matrix { pub fn rows_range>( &self, rows: RowRange, - ) -> MatrixSlice { + ) -> MatrixSlice<'_, T, RowRange::Size, C, S::RStride, S::CStride> { self.slice_range(rows, ..) } @@ -898,7 +898,7 @@ impl> Matrix { pub fn columns_range>( &self, cols: ColRange, - ) -> MatrixSlice { + ) -> MatrixSlice<'_, T, R, ColRange::Size, S::RStride, S::CStride> { self.slice_range(.., cols) } } @@ -912,7 +912,7 @@ impl> Matrix { &mut self, rows: RowRange, cols: ColRange, - ) -> MatrixSliceMut + ) -> MatrixSliceMut<'_, T, RowRange::Size, ColRange::Size, S::RStride, S::CStride> where RowRange: SliceRange, ColRange: SliceRange, @@ -929,7 +929,7 @@ impl> Matrix { pub fn rows_range_mut>( &mut self, rows: RowRange, - ) -> MatrixSliceMut { + ) -> MatrixSliceMut<'_, T, RowRange::Size, C, S::RStride, S::CStride> { self.slice_range_mut(rows, ..) } @@ -938,7 +938,7 @@ impl> Matrix { pub fn columns_range_mut>( &mut self, cols: ColRange, - ) -> MatrixSliceMut { + ) -> MatrixSliceMut<'_, T, R, ColRange::Size, S::RStride, S::CStride> { self.slice_range_mut(.., cols) } } diff --git a/src/base/ops.rs b/src/base/ops.rs index 852f6490..f9401cc7 100644 --- a/src/base/ops.rs +++ b/src/base/ops.rs @@ -708,8 +708,8 @@ where rhs: &Matrix, out: &mut Matrix, dot: impl Fn( - &VectorSlice, - &VectorSlice, + &VectorSlice<'_, T, R1, SA::RStride, SA::CStride>, + &VectorSlice<'_, T, R2, SB::RStride, SB::CStride>, ) -> T, ) where SB: Storage, diff --git a/src/base/statistics.rs b/src/base/statistics.rs index 59d78482..dbb2231c 100644 --- a/src/base/statistics.rs +++ b/src/base/statistics.rs @@ -12,7 +12,7 @@ impl> Matrix { #[must_use] pub fn compress_rows( &self, - f: impl Fn(VectorSlice) -> T, + f: impl Fn(VectorSlice<'_, T, R, S::RStride, S::CStride>) -> T, ) -> RowOVector where DefaultAllocator: Allocator, @@ -39,7 +39,7 @@ impl> Matrix { #[must_use] pub fn compress_rows_tr( &self, - f: impl Fn(VectorSlice) -> T, + f: impl Fn(VectorSlice<'_, T, R, S::RStride, S::CStride>) -> T, ) -> OVector where DefaultAllocator: Allocator, @@ -64,7 +64,7 @@ impl> Matrix { pub fn compress_columns( &self, init: OVector, - f: impl Fn(&mut OVector, VectorSlice), + f: impl Fn(&mut OVector, VectorSlice<'_, T, R, S::RStride, S::CStride>), ) -> OVector where DefaultAllocator: Allocator, diff --git a/src/geometry/dual_quaternion.rs b/src/geometry/dual_quaternion.rs index 01ea9dcc..e20b3778 100644 --- a/src/geometry/dual_quaternion.rs +++ b/src/geometry/dual_quaternion.rs @@ -896,7 +896,7 @@ impl Default for UnitDualQuaternion { } impl fmt::Display for UnitDualQuaternion { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { if let Some(axis) = self.rotation().axis() { let axis = axis.into_inner(); write!( diff --git a/src/geometry/isometry.rs b/src/geometry/isometry.rs index 333468b3..f8e63d07 100755 --- a/src/geometry/isometry.rs +++ b/src/geometry/isometry.rs @@ -642,7 +642,7 @@ impl fmt::Display for Isometry fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let precision = f.precision().unwrap_or(3); writeln!(f, "Isometry {{")?; diff --git a/src/geometry/orthographic.rs b/src/geometry/orthographic.rs index 3b73d944..1b908f33 100644 --- a/src/geometry/orthographic.rs +++ b/src/geometry/orthographic.rs @@ -32,7 +32,7 @@ impl Clone for Orthographic3 { } impl fmt::Debug for Orthographic3 { - fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { self.matrix.fmt(f) } } diff --git a/src/geometry/perspective.rs b/src/geometry/perspective.rs index ba8368a2..f9246af1 100644 --- a/src/geometry/perspective.rs +++ b/src/geometry/perspective.rs @@ -33,7 +33,7 @@ impl Clone for Perspective3 { } impl fmt::Debug for Perspective3 { - fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { self.matrix.fmt(f) } } diff --git a/src/geometry/point.rs b/src/geometry/point.rs index faf4f48f..40936d75 100644 --- a/src/geometry/point.rs +++ b/src/geometry/point.rs @@ -273,7 +273,7 @@ where #[inline] pub fn iter( &self, - ) -> MatrixIter, >::Buffer> { + ) -> MatrixIter<'_, T, D, Const<1>, >::Buffer> { self.coords.iter() } @@ -299,7 +299,7 @@ where #[inline] pub fn iter_mut( &mut self, - ) -> MatrixIterMut, >::Buffer> { + ) -> MatrixIterMut<'_, T, D, Const<1>, >::Buffer> { self.coords.iter_mut() } @@ -454,7 +454,7 @@ impl fmt::Display for OPoint where DefaultAllocator: Allocator, { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{{")?; let mut it = self.coords.iter(); diff --git a/src/geometry/quaternion.rs b/src/geometry/quaternion.rs index 3449f1ae..cd248c94 100755 --- a/src/geometry/quaternion.rs +++ b/src/geometry/quaternion.rs @@ -241,7 +241,7 @@ where /// ``` #[inline] #[must_use] - pub fn vector(&self) -> MatrixSlice, CStride> { + pub fn vector(&self) -> MatrixSlice<'_, T, U3, U1, RStride, CStride> { self.coords.fixed_rows::<3>(0) } @@ -633,7 +633,7 @@ where #[inline] pub fn vector_mut( &mut self, - ) -> MatrixSliceMut, CStride> { + ) -> MatrixSliceMut<'_, T, U3, U1, RStride, CStride> { self.coords.fixed_rows_mut::<3>(0) } @@ -1046,7 +1046,7 @@ impl> UlpsEq for Quaternion { } impl fmt::Display for Quaternion { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( f, "Quaternion {} − ({}, {}, {})", @@ -1692,7 +1692,7 @@ impl Default for UnitQuaternion { } impl fmt::Display for UnitQuaternion { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { if let Some(axis) = self.axis() { let axis = axis.into_inner(); write!( diff --git a/src/geometry/quaternion_construction.rs b/src/geometry/quaternion_construction.rs index 7a681bb2..f93069b4 100644 --- a/src/geometry/quaternion_construction.rs +++ b/src/geometry/quaternion_construction.rs @@ -894,9 +894,9 @@ where #[cfg(test)] #[cfg(feature = "rand")] mod tests { - extern crate rand_xorshift; use super::*; use rand::SeedableRng; + use rand_xorshift; #[test] fn random_unit_quats_are_unit() { diff --git a/src/geometry/rotation.rs b/src/geometry/rotation.rs index 98e8fcbc..bbe6f60b 100755 --- a/src/geometry/rotation.rs +++ b/src/geometry/rotation.rs @@ -565,7 +565,7 @@ impl fmt::Display for Rotation where T: RealField + fmt::Display, { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let precision = f.precision().unwrap_or(3); writeln!(f, "Rotation matrix {{")?; diff --git a/src/geometry/similarity.rs b/src/geometry/similarity.rs index 19164439..32a19772 100755 --- a/src/geometry/similarity.rs +++ b/src/geometry/similarity.rs @@ -429,7 +429,7 @@ where T: RealField + fmt::Display, R: AbstractRotation + fmt::Display, { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let precision = f.precision().unwrap_or(3); writeln!(f, "Similarity {{")?; diff --git a/src/geometry/translation.rs b/src/geometry/translation.rs index c667a512..76c771a7 100755 --- a/src/geometry/translation.rs +++ b/src/geometry/translation.rs @@ -332,7 +332,7 @@ where * */ impl fmt::Display for Translation { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let precision = f.precision().unwrap_or(3); writeln!(f, "Translation {{")?; diff --git a/src/geometry/unit_complex.rs b/src/geometry/unit_complex.rs index d6a7316c..d6f3d0dc 100755 --- a/src/geometry/unit_complex.rs +++ b/src/geometry/unit_complex.rs @@ -412,7 +412,7 @@ where } impl fmt::Display for UnitComplex { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "UnitComplex angle: {}", self.angle()) } } diff --git a/src/lib.rs b/src/lib.rs index c5c4dcd8..28767346 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -82,6 +82,7 @@ an optimized set of tools for computer graphics and physics. Those features incl #![deny(unused_qualifications)] #![deny(unused_results)] #![deny(missing_docs)] +#![deny(rust_2018_idioms)] #![doc( html_favicon_url = "https://nalgebra.org/img/favicon.ico", html_root_url = "https://docs.rs/nalgebra/0.25.0" diff --git a/src/linalg/solve.rs b/src/linalg/solve.rs index 7f9b7dae..32221fec 100644 --- a/src/linalg/solve.rs +++ b/src/linalg/solve.rs @@ -376,8 +376,8 @@ impl> SquareMatrix { b: &mut Vector, conjugate: impl Fn(T) -> T, dot: impl Fn( - &DVectorSlice, - &DVectorSlice, + &DVectorSlice<'_, T, S::RStride, S::CStride>, + &DVectorSlice<'_, T, S2::RStride, S2::CStride>, ) -> T, ) -> bool where @@ -411,8 +411,8 @@ impl> SquareMatrix { b: &mut Vector, conjugate: impl Fn(T) -> T, dot: impl Fn( - &DVectorSlice, - &DVectorSlice, + &DVectorSlice<'_, T, S::RStride, S::CStride>, + &DVectorSlice<'_, T, S2::RStride, S2::CStride>, ) -> T, ) -> bool where @@ -734,8 +734,8 @@ impl> SquareMatrix { b: &mut Vector, conjugate: impl Fn(T) -> T, dot: impl Fn( - &DVectorSlice, - &DVectorSlice, + &DVectorSlice<'_, T, S::RStride, S::CStride>, + &DVectorSlice<'_, T, S2::RStride, S2::CStride>, ) -> T, ) where S2: StorageMut, @@ -760,8 +760,8 @@ impl> SquareMatrix { b: &mut Vector, conjugate: impl Fn(T) -> T, dot: impl Fn( - &DVectorSlice, - &DVectorSlice, + &DVectorSlice<'_, T, S::RStride, S::CStride>, + &DVectorSlice<'_, T, S2::RStride, S2::CStride>, ) -> T, ) where S2: StorageMut,