From 6293d3375bb0095c0ba7fb89fa78c340f378ccfd Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Sun, 11 Oct 2020 10:57:26 +0200 Subject: [PATCH] clippy: fix #redundant_field_names --- src/base/dimension.rs | 2 +- src/base/matrix.rs | 2 +- src/base/vec_storage.rs | 6 +----- src/geometry/orthographic.rs | 2 +- src/geometry/perspective.rs | 2 +- src/geometry/point.rs | 2 +- src/geometry/rotation.rs | 2 +- src/geometry/transform.rs | 2 +- src/geometry/translation.rs | 2 +- src/linalg/full_piv_lu.rs | 12 ++---------- src/linalg/lu.rs | 4 ++-- src/linalg/qr.rs | 10 ++-------- src/linalg/schur.rs | 6 ++---- 13 files changed, 17 insertions(+), 37 deletions(-) diff --git a/src/base/dimension.rs b/src/base/dimension.rs index c171ff23..3f77998e 100644 --- a/src/base/dimension.rs +++ b/src/base/dimension.rs @@ -23,7 +23,7 @@ impl Dynamic { /// A dynamic size equal to `value`. #[inline] pub fn new(value: usize) -> Self { - Self { value: value } + Self { value } } } diff --git a/src/base/matrix.rs b/src/base/matrix.rs index 6e6aaba5..ca7fa77b 100644 --- a/src/base/matrix.rs +++ b/src/base/matrix.rs @@ -191,7 +191,7 @@ impl Matrix { #[inline] pub unsafe fn from_data_statically_unchecked(data: S) -> Matrix { Matrix { - data: data, + data, _phantoms: PhantomData, } } diff --git a/src/base/vec_storage.rs b/src/base/vec_storage.rs index 26948693..40909c32 100644 --- a/src/base/vec_storage.rs +++ b/src/base/vec_storage.rs @@ -41,11 +41,7 @@ impl VecStorage { nrows.value() * ncols.value() == data.len(), "Data storage buffer dimension mismatch." ); - Self { - data: data, - nrows: nrows, - ncols: ncols, - } + Self { data, nrows, ncols } } /// The underlying data storage. diff --git a/src/geometry/orthographic.rs b/src/geometry/orthographic.rs index c9bc76e6..9f0eadaf 100644 --- a/src/geometry/orthographic.rs +++ b/src/geometry/orthographic.rs @@ -139,7 +139,7 @@ impl Orthographic3 { /// ``` #[inline] pub fn from_matrix_unchecked(matrix: Matrix4) -> Self { - Self { matrix: matrix } + Self { matrix } } /// Creates a new orthographic projection matrix from an aspect ratio and the vertical field of view. diff --git a/src/geometry/perspective.rs b/src/geometry/perspective.rs index ed7649fd..db283609 100644 --- a/src/geometry/perspective.rs +++ b/src/geometry/perspective.rs @@ -97,7 +97,7 @@ impl Perspective3 { /// projection. #[inline] pub fn from_matrix_unchecked(matrix: Matrix4) -> Self { - Self { matrix: matrix } + Self { matrix } } /// Retrieves the inverse of the underlying homogeneous matrix. diff --git a/src/geometry/point.rs b/src/geometry/point.rs index ab26589b..d12b9212 100644 --- a/src/geometry/point.rs +++ b/src/geometry/point.rs @@ -135,7 +135,7 @@ where #[deprecated(note = "Use Point::from(vector) instead.")] #[inline] pub fn from_coordinates(coords: VectorN) -> Self { - Self { coords: coords } + Self { coords } } /// The dimension of this point. diff --git a/src/geometry/rotation.rs b/src/geometry/rotation.rs index c6cd3d86..bb3fc235 100755 --- a/src/geometry/rotation.rs +++ b/src/geometry/rotation.rs @@ -255,7 +255,7 @@ where "Unable to create a rotation from a non-square matrix." ); - Self { matrix: matrix } + Self { matrix } } /// Transposes `self`. diff --git a/src/geometry/transform.rs b/src/geometry/transform.rs index 42586509..80b72771 100755 --- a/src/geometry/transform.rs +++ b/src/geometry/transform.rs @@ -245,7 +245,7 @@ where #[inline] pub fn from_matrix_unchecked(matrix: MatrixN>) -> Self { Transform { - matrix: matrix, + matrix, _phantom: PhantomData, } } diff --git a/src/geometry/translation.rs b/src/geometry/translation.rs index 88d52ce4..26bbfd12 100755 --- a/src/geometry/translation.rs +++ b/src/geometry/translation.rs @@ -119,7 +119,7 @@ where #[inline] #[deprecated(note = "Use `::from` instead.")] pub fn from_vector(vector: VectorN) -> Translation { - Translation { vector: vector } + Translation { vector } } /// Inverts `self`. diff --git a/src/linalg/full_piv_lu.rs b/src/linalg/full_piv_lu.rs index bfa6854f..146b2cb7 100644 --- a/src/linalg/full_piv_lu.rs +++ b/src/linalg/full_piv_lu.rs @@ -60,11 +60,7 @@ where let mut q = PermutationSequence::identity_generic(min_nrows_ncols); if min_nrows_ncols.value() == 0 { - return Self { - lu: matrix, - p: p, - q: q, - }; + return Self { lu: matrix, p, q }; } for i in 0..min_nrows_ncols.value() { @@ -90,11 +86,7 @@ where } } - Self { - lu: matrix, - p: p, - q: q, - } + Self { lu: matrix, p, q } } #[doc(hidden)] diff --git a/src/linalg/lu.rs b/src/linalg/lu.rs index b3acaaa0..6aa84d62 100644 --- a/src/linalg/lu.rs +++ b/src/linalg/lu.rs @@ -96,7 +96,7 @@ where let mut p = PermutationSequence::identity_generic(min_nrows_ncols); if min_nrows_ncols.value() == 0 { - return LU { lu: matrix, p: p }; + return LU { lu: matrix, p }; } for i in 0..min_nrows_ncols.value() { @@ -117,7 +117,7 @@ where } } - LU { lu: matrix, p: p } + LU { lu: matrix, p } } #[doc(hidden)] diff --git a/src/linalg/qr.rs b/src/linalg/qr.rs index f218d47b..48d7a896 100644 --- a/src/linalg/qr.rs +++ b/src/linalg/qr.rs @@ -57,20 +57,14 @@ where let mut diag = unsafe { MatrixMN::new_uninitialized_generic(min_nrows_ncols, U1) }; if min_nrows_ncols.value() == 0 { - return QR { - qr: matrix, - diag: diag, - }; + return QR { qr: matrix, diag }; } for ite in 0..min_nrows_ncols.value() { householder::clear_column_unchecked(&mut matrix, &mut diag[ite], ite, 0, None); } - QR { - qr: matrix, - diag: diag, - } + QR { qr: matrix, diag } } /// Retrieves the upper trapezoidal submatrix `R` of this decomposition. diff --git a/src/linalg/schur.rs b/src/linalg/schur.rs index 99e73ea1..acdcd3dd 100644 --- a/src/linalg/schur.rs +++ b/src/linalg/schur.rs @@ -73,10 +73,8 @@ where pub fn try_new(m: MatrixN, eps: N::RealField, max_niter: usize) -> Option { let mut work = unsafe { VectorN::new_uninitialized_generic(m.data.shape().0, U1) }; - Self::do_decompose(m, &mut work, eps, max_niter, true).map(|(q, t)| Schur { - q: q.unwrap(), - t: t, - }) + Self::do_decompose(m, &mut work, eps, max_niter, true) + .map(|(q, t)| Schur { q: q.unwrap(), t }) } fn do_decompose(