Skip to content

Commit

Permalink
Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jturner314 committed Feb 18, 2021
1 parent fbf2f28 commit 87a6448
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/data_traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<D>(self_: ArrayBase<Self, D>) -> ArrayBase<OwnedRepr<Self::Elem>, D>
where
Self::Elem: Clone,
Expand All @@ -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<D>(self_: &ArrayBase<Self, D>) -> ArrayBase<OwnedArcRepr<Self::Elem>, D>
where
Self::Elem: Clone,
Expand Down
2 changes: 1 addition & 1 deletion src/dimension/dynindeximpl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl<T: Copy + Zero> IxDynRepr<T> {
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)
Expand Down
1 change: 1 addition & 0 deletions src/impl_constructors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ where
///
/// let array = Array::from_iter(0..10);
/// ```
#[allow(clippy::should_implement_trait)]
pub fn from_iter<I: IntoIterator<Item = A>>(iterable: I) -> Self {
Self::from_vec(iterable.into_iter().collect())
}
Expand Down
4 changes: 2 additions & 2 deletions src/impl_internal_constructors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<A>) -> Self {
let array = ArrayBase {
data: data,
ptr: ptr,
data,
ptr,
dim: Ix1(0),
strides: Ix1(1),
};
Expand Down
1 change: 1 addition & 0 deletions src/linalg/impl_linalg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,7 @@ pub fn general_mat_vec_mul<A, S1, S2, S3>(
///
/// 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<A, S1, S2>(
alpha: A,
a: &ArrayBase<S1, Ix2>,
Expand Down

0 comments on commit 87a6448

Please sign in to comment.