From c756496b710a962f632061b2e9c153488aeaefb7 Mon Sep 17 00:00:00 2001 From: Luis Moreno Date: Mon, 9 Nov 2020 00:21:02 -0400 Subject: [PATCH] Fix clippy::len_without_is_empty --- src/lib.rs | 1 - src/linalg/mod.rs | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 8c97bf7..4e87301 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -67,7 +67,6 @@ #![allow( clippy::needless_range_loop, clippy::ptr_arg, - clippy::len_without_is_empty, clippy::map_entry, clippy::type_complexity, clippy::too_many_arguments, diff --git a/src/linalg/mod.rs b/src/linalg/mod.rs index fc9d6c9..896d718 100644 --- a/src/linalg/mod.rs +++ b/src/linalg/mod.rs @@ -76,6 +76,11 @@ pub trait BaseVector: Clone + Debug { /// Get number of elevemnt in the vector fn len(&self) -> usize; + /// Returns true if the vector is empty. + fn is_empty(&self) -> bool { + self.len() == 0 + } + /// Return a vector with the elements of the one-dimensional array. fn to_vec(&self) -> Vec;