clippy: fix #redundant_field_names

This commit is contained in:
Philippe Renon 2020-10-11 10:57:26 +02:00
parent fb15658cc9
commit 6293d3375b
13 changed files with 17 additions and 37 deletions

View File

@ -23,7 +23,7 @@ impl Dynamic {
/// A dynamic size equal to `value`. /// A dynamic size equal to `value`.
#[inline] #[inline]
pub fn new(value: usize) -> Self { pub fn new(value: usize) -> Self {
Self { value: value } Self { value }
} }
} }

View File

@ -191,7 +191,7 @@ impl<N: Scalar, R: Dim, C: Dim, S> Matrix<N, R, C, S> {
#[inline] #[inline]
pub unsafe fn from_data_statically_unchecked(data: S) -> Matrix<N, R, C, S> { pub unsafe fn from_data_statically_unchecked(data: S) -> Matrix<N, R, C, S> {
Matrix { Matrix {
data: data, data,
_phantoms: PhantomData, _phantoms: PhantomData,
} }
} }

View File

@ -41,11 +41,7 @@ impl<N, R: Dim, C: Dim> VecStorage<N, R, C> {
nrows.value() * ncols.value() == data.len(), nrows.value() * ncols.value() == data.len(),
"Data storage buffer dimension mismatch." "Data storage buffer dimension mismatch."
); );
Self { Self { data, nrows, ncols }
data: data,
nrows: nrows,
ncols: ncols,
}
} }
/// The underlying data storage. /// The underlying data storage.

View File

@ -139,7 +139,7 @@ impl<N: RealField> Orthographic3<N> {
/// ``` /// ```
#[inline] #[inline]
pub fn from_matrix_unchecked(matrix: Matrix4<N>) -> Self { pub fn from_matrix_unchecked(matrix: Matrix4<N>) -> Self {
Self { matrix: matrix } Self { matrix }
} }
/// Creates a new orthographic projection matrix from an aspect ratio and the vertical field of view. /// Creates a new orthographic projection matrix from an aspect ratio and the vertical field of view.

View File

@ -97,7 +97,7 @@ impl<N: RealField> Perspective3<N> {
/// projection. /// projection.
#[inline] #[inline]
pub fn from_matrix_unchecked(matrix: Matrix4<N>) -> Self { pub fn from_matrix_unchecked(matrix: Matrix4<N>) -> Self {
Self { matrix: matrix } Self { matrix }
} }
/// Retrieves the inverse of the underlying homogeneous matrix. /// Retrieves the inverse of the underlying homogeneous matrix.

View File

@ -135,7 +135,7 @@ where
#[deprecated(note = "Use Point::from(vector) instead.")] #[deprecated(note = "Use Point::from(vector) instead.")]
#[inline] #[inline]
pub fn from_coordinates(coords: VectorN<N, D>) -> Self { pub fn from_coordinates(coords: VectorN<N, D>) -> Self {
Self { coords: coords } Self { coords }
} }
/// The dimension of this point. /// The dimension of this point.

View File

@ -255,7 +255,7 @@ where
"Unable to create a rotation from a non-square matrix." "Unable to create a rotation from a non-square matrix."
); );
Self { matrix: matrix } Self { matrix }
} }
/// Transposes `self`. /// Transposes `self`.

View File

@ -245,7 +245,7 @@ where
#[inline] #[inline]
pub fn from_matrix_unchecked(matrix: MatrixN<N, DimNameSum<D, U1>>) -> Self { pub fn from_matrix_unchecked(matrix: MatrixN<N, DimNameSum<D, U1>>) -> Self {
Transform { Transform {
matrix: matrix, matrix,
_phantom: PhantomData, _phantom: PhantomData,
} }
} }

View File

@ -119,7 +119,7 @@ where
#[inline] #[inline]
#[deprecated(note = "Use `::from` instead.")] #[deprecated(note = "Use `::from` instead.")]
pub fn from_vector(vector: VectorN<N, D>) -> Translation<N, D> { pub fn from_vector(vector: VectorN<N, D>) -> Translation<N, D> {
Translation { vector: vector } Translation { vector }
} }
/// Inverts `self`. /// Inverts `self`.

View File

@ -60,11 +60,7 @@ where
let mut q = PermutationSequence::identity_generic(min_nrows_ncols); let mut q = PermutationSequence::identity_generic(min_nrows_ncols);
if min_nrows_ncols.value() == 0 { if min_nrows_ncols.value() == 0 {
return Self { return Self { lu: matrix, p, q };
lu: matrix,
p: p,
q: q,
};
} }
for i in 0..min_nrows_ncols.value() { for i in 0..min_nrows_ncols.value() {
@ -90,11 +86,7 @@ where
} }
} }
Self { Self { lu: matrix, p, q }
lu: matrix,
p: p,
q: q,
}
} }
#[doc(hidden)] #[doc(hidden)]

View File

@ -96,7 +96,7 @@ where
let mut p = PermutationSequence::identity_generic(min_nrows_ncols); let mut p = PermutationSequence::identity_generic(min_nrows_ncols);
if min_nrows_ncols.value() == 0 { 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() { for i in 0..min_nrows_ncols.value() {
@ -117,7 +117,7 @@ where
} }
} }
LU { lu: matrix, p: p } LU { lu: matrix, p }
} }
#[doc(hidden)] #[doc(hidden)]

View File

@ -57,20 +57,14 @@ where
let mut diag = unsafe { MatrixMN::new_uninitialized_generic(min_nrows_ncols, U1) }; let mut diag = unsafe { MatrixMN::new_uninitialized_generic(min_nrows_ncols, U1) };
if min_nrows_ncols.value() == 0 { if min_nrows_ncols.value() == 0 {
return QR { return QR { qr: matrix, diag };
qr: matrix,
diag: diag,
};
} }
for ite in 0..min_nrows_ncols.value() { for ite in 0..min_nrows_ncols.value() {
householder::clear_column_unchecked(&mut matrix, &mut diag[ite], ite, 0, None); householder::clear_column_unchecked(&mut matrix, &mut diag[ite], ite, 0, None);
} }
QR { QR { qr: matrix, diag }
qr: matrix,
diag: diag,
}
} }
/// Retrieves the upper trapezoidal submatrix `R` of this decomposition. /// Retrieves the upper trapezoidal submatrix `R` of this decomposition.

View File

@ -73,10 +73,8 @@ where
pub fn try_new(m: MatrixN<N, D>, eps: N::RealField, max_niter: usize) -> Option<Self> { pub fn try_new(m: MatrixN<N, D>, eps: N::RealField, max_niter: usize) -> Option<Self> {
let mut work = unsafe { VectorN::new_uninitialized_generic(m.data.shape().0, U1) }; 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 { Self::do_decompose(m, &mut work, eps, max_niter, true)
q: q.unwrap(), .map(|(q, t)| Schur { q: q.unwrap(), t })
t: t,
})
} }
fn do_decompose( fn do_decompose(