Skip to content

Commit

Permalink
Merge pull request #1190 from jturner314/cherry-pick-1171
Browse files Browse the repository at this point in the history
Cherry pick non-breaking portions of #1171 to 0.15.x
  • Loading branch information
jturner314 authored Jul 30, 2022
2 parents 739316e + 1d0212c commit dedb15f
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 24 deletions.
14 changes: 7 additions & 7 deletions src/arrayformat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<S, D>
impl<A: fmt::Display, S, D: Dimension> fmt::Display for ArrayBase<S, D>
where
S: Data<Elem = A>,
{
Expand All @@ -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<S, D>
impl<A: fmt::Debug, S, D: Dimension> fmt::Debug for ArrayBase<S, D>
where
S: Data<Elem = A>,
{
Expand All @@ -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)?,
Expand All @@ -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<S, D>
impl<A: fmt::LowerExp, S, D: Dimension> fmt::LowerExp for ArrayBase<S, D>
where
S: Data<Elem = A>,
{
Expand All @@ -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<S, D>
impl<A: fmt::UpperExp, S, D: Dimension> fmt::UpperExp for ArrayBase<S, D>
where
S: Data<Elem = A>,
{
Expand All @@ -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<S, D>
impl<A: fmt::LowerHex, S, D: Dimension> fmt::LowerHex for ArrayBase<S, D>
where
S: Data<Elem = A>,
{
Expand All @@ -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<S, D>
impl<A: fmt::Binary, S, D: Dimension> fmt::Binary for ArrayBase<S, D>
where
S: Data<Elem = A>,
{
Expand Down
2 changes: 1 addition & 1 deletion src/arraytraits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ where
}
}

impl<'a, S, D> hash::Hash for ArrayBase<S, D>
impl<S, D> hash::Hash for ArrayBase<S, D>
where
D: Dimension,
S: Data,
Expand Down
1 change: 1 addition & 0 deletions src/data_traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
4 changes: 2 additions & 2 deletions src/dimension/dynindeximpl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl<T> Deref for IxDynRepr<T> {
debug_assert!(len as usize <= ar.len());
unsafe { ar.get_unchecked(..len as usize) }
}
IxDynRepr::Alloc(ref ar) => &*ar,
IxDynRepr::Alloc(ref ar) => ar,
}
}
}
Expand All @@ -33,7 +33,7 @@ impl<T> DerefMut for IxDynRepr<T> {
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,
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/dimension/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ where
}
}

impl<'a> DimensionExt for [Ix] {
impl DimensionExt for [Ix] {
#[inline]
fn axis(&self, axis: Axis) -> Ix {
self[axis.index()]
Expand Down
2 changes: 1 addition & 1 deletion src/dimension/ndindex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ unsafe impl<'a> NdIndex<IxDyn> for &'a IxDyn {

unsafe impl<'a> NdIndex<IxDyn> for &'a [Ix] {
fn index_checked(&self, dim: &IxDyn, strides: &IxDyn) -> Option<isize> {
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)
Expand Down
1 change: 1 addition & 0 deletions src/impl_constructors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 8 additions & 10 deletions src/iterators/lanes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/iterators/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ impl<A, D: Dimension> Iterator for Baseiter<A, D> {
}
}

impl<'a, A, D: Dimension> ExactSizeIterator for Baseiter<A, D> {
impl<A, D: Dimension> ExactSizeIterator for Baseiter<A, D> {
fn len(&self) -> usize {
match self.index {
None => 0,
Expand Down
3 changes: 2 additions & 1 deletion src/itertools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() { }
/// ```
Expand Down

0 comments on commit dedb15f

Please sign in to comment.