From 2ea750380701c6686ec938c1ebe279c805ef4dd9 Mon Sep 17 00:00:00 2001 From: Jim Turner Date: Thu, 18 Feb 2021 14:07:02 -0500 Subject: [PATCH] Fix clippy warnings --- src/data_traits.rs | 2 ++ src/dimension/dynindeximpl.rs | 2 +- src/impl_constructors.rs | 1 + src/impl_internal_constructors.rs | 4 ++-- src/linalg/impl_linalg.rs | 1 + 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/data_traits.rs b/src/data_traits.rs index 2b59fcb8d..1e191c468 100644 --- a/src/data_traits.rs +++ b/src/data_traits.rs @@ -94,6 +94,7 @@ pub unsafe trait RawDataClone: RawData { pub unsafe trait Data: RawData { /// Converts the array to a uniquely owned array, cloning elements if necessary. #[doc(hidden)] + #[allow(clippy::wrong_self_convention)] fn into_owned(self_: ArrayBase) -> ArrayBase, D> where Self::Elem: Clone, @@ -102,6 +103,7 @@ pub unsafe trait Data: RawData { /// Return a shared ownership (copy on write) array based on the existing one, /// cloning elements if necessary. #[doc(hidden)] + #[allow(clippy::wrong_self_convention)] fn to_shared(self_: &ArrayBase) -> ArrayBase, D> where Self::Elem: Clone, diff --git a/src/dimension/dynindeximpl.rs b/src/dimension/dynindeximpl.rs index 5c9cd0d61..b75db91c5 100644 --- a/src/dimension/dynindeximpl.rs +++ b/src/dimension/dynindeximpl.rs @@ -51,7 +51,7 @@ impl IxDynRepr { pub fn copy_from(x: &[T]) -> Self { if x.len() <= CAP { let mut arr = [T::zero(); CAP]; - arr[..x.len()].copy_from_slice(&x[..]); + arr[..x.len()].copy_from_slice(x); IxDynRepr::Inline(x.len() as _, arr) } else { Self::from(x) diff --git a/src/impl_constructors.rs b/src/impl_constructors.rs index 71ca8b32d..63688ea7f 100644 --- a/src/impl_constructors.rs +++ b/src/impl_constructors.rs @@ -73,6 +73,7 @@ where /// /// let array = Array::from_iter(0..10); /// ``` + #[allow(clippy::should_implement_trait)] pub fn from_iter>(iterable: I) -> Self { Self::from_vec(iterable.into_iter().collect()) } diff --git a/src/impl_internal_constructors.rs b/src/impl_internal_constructors.rs index 0ed60a622..5d47c9897 100644 --- a/src/impl_internal_constructors.rs +++ b/src/impl_internal_constructors.rs @@ -25,8 +25,8 @@ where /// See ArrayView::from_shape_ptr for general pointer validity documentation. pub(crate) unsafe fn from_data_ptr(data: S, ptr: NonNull) -> Self { let array = ArrayBase { - data: data, - ptr: ptr, + data, + ptr, dim: Ix1(0), strides: Ix1(1), }; diff --git a/src/linalg/impl_linalg.rs b/src/linalg/impl_linalg.rs index 878444c26..61b91eaed 100644 --- a/src/linalg/impl_linalg.rs +++ b/src/linalg/impl_linalg.rs @@ -613,6 +613,7 @@ pub fn general_mat_vec_mul( /// /// The caller must ensure that the raw view is valid for writing. /// the destination may be uninitialized iff beta is zero. +#[allow(clippy::collapsible_else_if)] unsafe fn general_mat_vec_mul_impl( alpha: A, a: &ArrayBase,