From d577a18a451c52b710c1d3b163d2f032e77012d9 Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Mon, 26 Oct 2020 14:07:52 +0100 Subject: [PATCH] clippy: fix or_fun_call warnings --- src/base/construction.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/base/construction.rs b/src/base/construction.rs index 7f293554..ac6eed1e 100644 --- a/src/base/construction.rs +++ b/src/base/construction.rs @@ -196,7 +196,7 @@ where SB: Storage, { assert!(rows.len() > 0, "At least one row must be given."); - let nrows = R::try_to_usize().unwrap_or(rows.len()); + let nrows = R::try_to_usize().unwrap_or_else(|| rows.len()); let ncols = rows[0].len(); assert!( rows.len() == nrows, @@ -803,8 +803,8 @@ where { #[inline] fn sample<'a, G: Rng + ?Sized>(&self, rng: &'a mut G) -> MatrixMN { - let nrows = R::try_to_usize().unwrap_or(rng.gen_range(0, 10)); - let ncols = C::try_to_usize().unwrap_or(rng.gen_range(0, 10)); + let nrows = R::try_to_usize().unwrap_or_else(|| rng.gen_range(0, 10)); + let ncols = C::try_to_usize().unwrap_or_else(|| rng.gen_range(0, 10)); MatrixMN::from_fn_generic(R::from_usize(nrows), C::from_usize(ncols), |_, _| rng.gen()) }