clippy: fix or_fun_call warnings

This commit is contained in:
Philippe Renon 2020-11-16 15:17:10 +01:00
parent 6caa277ebd
commit 726b8eeecf
3 changed files with 6 additions and 6 deletions

View File

@ -238,7 +238,7 @@ where
SB: Storage<N, R>, SB: Storage<N, R>,
{ {
assert!(!columns.is_empty(), "At least one column must be given."); assert!(!columns.is_empty(), "At least one column must be given.");
let ncols = C::try_to_usize().unwrap_or(columns.len()); let ncols = C::try_to_usize().unwrap_or_else(|| columns.len());
let nrows = columns[0].len(); let nrows = columns[0].len();
assert!( assert!(
columns.len() == ncols, columns.len() == ncols,

View File

@ -81,7 +81,7 @@ impl<N: RealField, D: Dim, S: Storage<N, D>> Unit<Vector<N, D, S>> {
{ {
// TODO: the result is wrong when self and rhs are collinear with opposite direction. // TODO: the result is wrong when self and rhs are collinear with opposite direction.
self.try_slerp(rhs, t, N::default_epsilon()) self.try_slerp(rhs, t, N::default_epsilon())
.unwrap_or(Unit::new_unchecked(self.clone_owned())) .unwrap_or_else(|| Unit::new_unchecked(self.clone_owned()))
} }
/// Computes the spherical linear interpolation between two unit vectors. /// Computes the spherical linear interpolation between two unit vectors.

View File

@ -57,7 +57,7 @@ impl<N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
N: SimdPartialOrd + Zero, N: SimdPartialOrd + Zero,
{ {
self.fold_with( self.fold_with(
|e| e.map(|e| e.inlined_clone()).unwrap_or(N::zero()), |e| e.map(|e| e.inlined_clone()).unwrap_or_else(N::zero),
|a, b| a.simd_max(b.inlined_clone()), |a, b| a.simd_max(b.inlined_clone()),
) )
} }
@ -75,7 +75,7 @@ impl<N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
N: Zero + SimdPartialOrd + SimdSigned, N: Zero + SimdPartialOrd + SimdSigned,
{ {
self.fold_with( self.fold_with(
|e| e.map(|e| e.simd_abs()).unwrap_or(N::zero()), |e| e.map(|e| e.simd_abs()).unwrap_or_else(N::zero),
|a, b| a.simd_min(b.simd_abs()), |a, b| a.simd_min(b.simd_abs()),
) )
} }
@ -97,7 +97,7 @@ impl<N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
self.fold_with( self.fold_with(
|e| { |e| {
e.map(|e| e.simd_norm1()) e.map(|e| e.simd_norm1())
.unwrap_or(N::SimdRealField::zero()) .unwrap_or_else(N::SimdRealField::zero)
}, },
|a, b| a.simd_min(b.simd_norm1()), |a, b| a.simd_min(b.simd_norm1()),
) )
@ -117,7 +117,7 @@ impl<N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
N: SimdPartialOrd + Zero, N: SimdPartialOrd + Zero,
{ {
self.fold_with( self.fold_with(
|e| e.map(|e| e.inlined_clone()).unwrap_or(N::zero()), |e| e.map(|e| e.inlined_clone()).unwrap_or_else(N::zero),
|a, b| a.simd_min(b.inlined_clone()), |a, b| a.simd_min(b.inlined_clone()),
) )
} }