forked from M-Labs/nalgebra
clippy: fix or_fun_call warnings
This commit is contained in:
parent
6caa277ebd
commit
726b8eeecf
@ -238,7 +238,7 @@ where
|
||||
SB: Storage<N, R>,
|
||||
{
|
||||
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();
|
||||
assert!(
|
||||
columns.len() == ncols,
|
||||
|
@ -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.
|
||||
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.
|
||||
|
@ -57,7 +57,7 @@ impl<N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
|
||||
N: SimdPartialOrd + Zero,
|
||||
{
|
||||
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()),
|
||||
)
|
||||
}
|
||||
@ -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,
|
||||
{
|
||||
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()),
|
||||
)
|
||||
}
|
||||
@ -97,7 +97,7 @@ impl<N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
|
||||
self.fold_with(
|
||||
|e| {
|
||||
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()),
|
||||
)
|
||||
@ -117,7 +117,7 @@ impl<N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
|
||||
N: SimdPartialOrd + Zero,
|
||||
{
|
||||
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()),
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user