diff --git a/src/arrayformat.rs b/src/arrayformat.rs index 5998a0c1e..ae781df6a 100644 --- a/src/arrayformat.rs +++ b/src/arrayformat.rs @@ -189,7 +189,7 @@ where /// to each element. /// /// The array is shown in multiline style. -impl<'a, A: fmt::Display, S, D: Dimension> fmt::Display for ArrayBase +impl fmt::Display for ArrayBase where S: Data, { @@ -203,7 +203,7 @@ where /// to each element. /// /// The array is shown in multiline style. -impl<'a, A: fmt::Debug, S, D: Dimension> fmt::Debug for ArrayBase +impl fmt::Debug for ArrayBase where S: Data, { @@ -217,7 +217,7 @@ where ", shape={:?}, strides={:?}, layout={:?}", self.shape(), self.strides(), - layout = self.view().layout() + self.view().layout(), )?; match D::NDIM { Some(ndim) => write!(f, ", const ndim={}", ndim)?, @@ -231,7 +231,7 @@ where /// to each element. /// /// The array is shown in multiline style. -impl<'a, A: fmt::LowerExp, S, D: Dimension> fmt::LowerExp for ArrayBase +impl fmt::LowerExp for ArrayBase where S: Data, { @@ -245,7 +245,7 @@ where /// to each element. /// /// The array is shown in multiline style. -impl<'a, A: fmt::UpperExp, S, D: Dimension> fmt::UpperExp for ArrayBase +impl fmt::UpperExp for ArrayBase where S: Data, { @@ -258,7 +258,7 @@ where /// to each element. /// /// The array is shown in multiline style. -impl<'a, A: fmt::LowerHex, S, D: Dimension> fmt::LowerHex for ArrayBase +impl fmt::LowerHex for ArrayBase where S: Data, { @@ -272,7 +272,7 @@ where /// to each element. /// /// The array is shown in multiline style. -impl<'a, A: fmt::Binary, S, D: Dimension> fmt::Binary for ArrayBase +impl fmt::Binary for ArrayBase where S: Data, { diff --git a/src/arraytraits.rs b/src/arraytraits.rs index 31d27b003..f51f5335e 100644 --- a/src/arraytraits.rs +++ b/src/arraytraits.rs @@ -252,7 +252,7 @@ where } } -impl<'a, S, D> hash::Hash for ArrayBase +impl hash::Hash for ArrayBase where D: Dimension, S: Data, diff --git a/src/data_traits.rs b/src/data_traits.rs index 679f9c782..acf4b0b7a 100644 --- a/src/data_traits.rs +++ b/src/data_traits.rs @@ -162,6 +162,7 @@ pub unsafe trait DataMut: Data + RawDataMut { /// Returns whether the array has unique access to its data. #[doc(hidden)] #[inline] + #[allow(clippy::wrong_self_convention)] // mut needed for Arc types fn is_unique(&mut self) -> bool { self.try_is_unique().unwrap() } diff --git a/src/dimension/dynindeximpl.rs b/src/dimension/dynindeximpl.rs index b75db91c5..85b34bdbe 100644 --- a/src/dimension/dynindeximpl.rs +++ b/src/dimension/dynindeximpl.rs @@ -21,7 +21,7 @@ impl Deref for IxDynRepr { debug_assert!(len as usize <= ar.len()); unsafe { ar.get_unchecked(..len as usize) } } - IxDynRepr::Alloc(ref ar) => &*ar, + IxDynRepr::Alloc(ref ar) => ar, } } } @@ -33,7 +33,7 @@ impl DerefMut for IxDynRepr { debug_assert!(len as usize <= ar.len()); unsafe { ar.get_unchecked_mut(..len as usize) } } - IxDynRepr::Alloc(ref mut ar) => &mut *ar, + IxDynRepr::Alloc(ref mut ar) => ar, } } } diff --git a/src/dimension/mod.rs b/src/dimension/mod.rs index f0752142b..2ba3b1ffa 100644 --- a/src/dimension/mod.rs +++ b/src/dimension/mod.rs @@ -333,7 +333,7 @@ where } } -impl<'a> DimensionExt for [Ix] { +impl DimensionExt for [Ix] { #[inline] fn axis(&self, axis: Axis) -> Ix { self[axis.index()] diff --git a/src/dimension/ndindex.rs b/src/dimension/ndindex.rs index 810a5b097..3a687c813 100644 --- a/src/dimension/ndindex.rs +++ b/src/dimension/ndindex.rs @@ -216,7 +216,7 @@ unsafe impl<'a> NdIndex for &'a IxDyn { unsafe impl<'a> NdIndex for &'a [Ix] { fn index_checked(&self, dim: &IxDyn, strides: &IxDyn) -> Option { - stride_offset_checked(dim.ix(), strides.ix(), *self) + stride_offset_checked(dim.ix(), strides.ix(), self) } fn index_unchecked(&self, strides: &IxDyn) -> isize { zip(strides.ix(), *self) diff --git a/src/impl_constructors.rs b/src/impl_constructors.rs index 4a18ff832..049384ceb 100644 --- a/src/impl_constructors.rs +++ b/src/impl_constructors.rs @@ -634,6 +634,7 @@ where #[deprecated(note = "This method is hard to use correctly. Use `uninit` instead.", since = "0.15.0")] + #[allow(clippy::uninit_vec)] // this is explicitly intended to create uninitialized memory /// Create an array with uninitialized elements, shape `shape`. /// /// Prefer to use [`uninit()`](ArrayBase::uninit) if possible, because it is diff --git a/src/iterators/lanes.rs b/src/iterators/lanes.rs index cda783a80..7286e0696 100644 --- a/src/iterators/lanes.rs +++ b/src/iterators/lanes.rs @@ -39,17 +39,16 @@ impl<'a, A, D: Dimension> Lanes<'a, A, D> { let ndim = v.ndim(); let len; let stride; - let iter_v; - if ndim == 0 { + let iter_v = if ndim == 0 { len = 1; stride = 1; - iter_v = v.try_remove_axis(Axis(0)) + v.try_remove_axis(Axis(0)) } else { let i = axis.index(); len = v.dim[i]; stride = v.strides[i] as isize; - iter_v = v.try_remove_axis(axis) - } + v.try_remove_axis(axis) + }; Lanes { inner_len: len, inner_stride: stride, @@ -108,17 +107,16 @@ impl<'a, A, D: Dimension> LanesMut<'a, A, D> { let ndim = v.ndim(); let len; let stride; - let iter_v; - if ndim == 0 { + let iter_v = if ndim == 0 { len = 1; stride = 1; - iter_v = v.try_remove_axis(Axis(0)) + v.try_remove_axis(Axis(0)) } else { let i = axis.index(); len = v.dim[i]; stride = v.strides[i] as isize; - iter_v = v.try_remove_axis(axis) - } + v.try_remove_axis(axis) + }; LanesMut { inner_len: len, inner_stride: stride, diff --git a/src/iterators/mod.rs b/src/iterators/mod.rs index e660a55d0..85da56fe5 100644 --- a/src/iterators/mod.rs +++ b/src/iterators/mod.rs @@ -103,7 +103,7 @@ impl Iterator for Baseiter { } } -impl<'a, A, D: Dimension> ExactSizeIterator for Baseiter { +impl ExactSizeIterator for Baseiter { fn len(&self) -> usize { match self.index { None => 0, diff --git a/src/itertools.rs b/src/itertools.rs index 4fa8145ab..8edfd75eb 100644 --- a/src/itertools.rs +++ b/src/itertools.rs @@ -86,7 +86,8 @@ where /// **Note:** To enable the macros in this crate, use the `#[macro_use]` /// attribute when importing the crate: /// -/// ``` +/// ```no_run +/// # #[allow(unused_imports)] /// #[macro_use] extern crate itertools; /// # fn main() { } /// ```