Skip to content

Commit

Permalink
Fixes a variety of lifetime elision warnings in CI/CD
Browse files Browse the repository at this point in the history
I frankly don't understand why these are just showing up now
  • Loading branch information
akern40 committed Nov 30, 2024
1 parent fd3ce5d commit 5b449e8
Show file tree
Hide file tree
Showing 15 changed files with 59 additions and 59 deletions.
2 changes: 1 addition & 1 deletion ndarray-rand/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ fn sampling_works(a: &Array2<f64>, strategy: SamplingStrategy, axis: Axis, n_sam
let samples = a.sample_axis(axis, n_samples, strategy);
samples
.axis_iter(axis)
.all(|lane| is_subset(&a, &lane, axis))
.all(|lane| is_subset(a, &lane, axis))
}

// Check if, when sliced along `axis`, there is at least one lane in `a` equal to `b`
Expand Down
8 changes: 4 additions & 4 deletions src/argument_traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub trait AssignElem<T>
}

/// Assignable element, simply `*self = input`.
impl<'a, T> AssignElem<T> for &'a mut T
impl<T> AssignElem<T> for &mut T
{
fn assign_elem(self, input: T)
{
Expand All @@ -20,7 +20,7 @@ impl<'a, T> AssignElem<T> for &'a mut T
}

/// Assignable element, simply `self.set(input)`.
impl<'a, T> AssignElem<T> for &'a Cell<T>
impl<T> AssignElem<T> for &Cell<T>
{
fn assign_elem(self, input: T)
{
Expand All @@ -29,7 +29,7 @@ impl<'a, T> AssignElem<T> for &'a Cell<T>
}

/// Assignable element, simply `self.set(input)`.
impl<'a, T> AssignElem<T> for &'a MathCell<T>
impl<T> AssignElem<T> for &MathCell<T>
{
fn assign_elem(self, input: T)
{
Expand All @@ -39,7 +39,7 @@ impl<'a, T> AssignElem<T> for &'a MathCell<T>

/// Assignable element, the item in the MaybeUninit is overwritten (prior value, if any, is not
/// read or dropped).
impl<'a, T> AssignElem<T> for &'a mut MaybeUninit<T>
impl<T> AssignElem<T> for &mut MaybeUninit<T>
{
fn assign_elem(self, input: T)
{
Expand Down
4 changes: 2 additions & 2 deletions src/array_serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ where
// private iterator wrapper
struct Sequence<'a, A, D>(Iter<'a, A, D>);

impl<'a, A, D> Serialize for Sequence<'a, A, D>
impl<A, D> Serialize for Sequence<'_, A, D>
where
A: Serialize,
D: Dimension + Serialize,
Expand Down Expand Up @@ -162,7 +162,7 @@ impl<'de> Deserialize<'de> for ArrayField
{
struct ArrayFieldVisitor;

impl<'de> Visitor<'de> for ArrayFieldVisitor
impl Visitor<'_> for ArrayFieldVisitor
{
type Value = ArrayField;

Expand Down
4 changes: 2 additions & 2 deletions src/arraytraits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ where
/// Return `true` if the array shapes and all elements of `self` and
/// `rhs` are equal. Return `false` otherwise.
#[allow(clippy::unconditional_recursion)] // false positive
impl<'a, A, B, S, S2, D> PartialEq<&'a ArrayBase<S2, D>> for ArrayBase<S, D>
impl<A, B, S, S2, D> PartialEq<&ArrayBase<S2, D>> for ArrayBase<S, D>
where
A: PartialEq<B>,
S: Data<Elem = A>,
Expand All @@ -144,7 +144,7 @@ where
/// Return `true` if the array shapes and all elements of `self` and
/// `rhs` are equal. Return `false` otherwise.
#[allow(clippy::unconditional_recursion)] // false positive
impl<'a, A, B, S, S2, D> PartialEq<ArrayBase<S2, D>> for &'a ArrayBase<S, D>
impl<A, B, S, S2, D> PartialEq<ArrayBase<S2, D>> for &ArrayBase<S, D>
where
A: PartialEq<B>,
S: Data<Elem = A>,
Expand Down
24 changes: 12 additions & 12 deletions src/data_traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ where A: Clone
}
}

unsafe impl<'a, A> RawData for ViewRepr<&'a A>
unsafe impl<A> RawData for ViewRepr<&A>
{
type Elem = A;

Expand All @@ -420,7 +420,7 @@ unsafe impl<'a, A> RawData for ViewRepr<&'a A>
private_impl! {}
}

unsafe impl<'a, A> Data for ViewRepr<&'a A>
unsafe impl<A> Data for ViewRepr<&A>
{
fn into_owned<D>(self_: ArrayBase<Self, D>) -> Array<Self::Elem, D>
where
Expand All @@ -437,15 +437,15 @@ unsafe impl<'a, A> Data for ViewRepr<&'a A>
}
}

unsafe impl<'a, A> RawDataClone for ViewRepr<&'a A>
unsafe impl<A> RawDataClone for ViewRepr<&A>
{
unsafe fn clone_with_ptr(&self, ptr: NonNull<Self::Elem>) -> (Self, NonNull<Self::Elem>)
{
(*self, ptr)
}
}

unsafe impl<'a, A> RawData for ViewRepr<&'a mut A>
unsafe impl<A> RawData for ViewRepr<&mut A>
{
type Elem = A;

Expand All @@ -458,7 +458,7 @@ unsafe impl<'a, A> RawData for ViewRepr<&'a mut A>
private_impl! {}
}

unsafe impl<'a, A> RawDataMut for ViewRepr<&'a mut A>
unsafe impl<A> RawDataMut for ViewRepr<&mut A>
{
#[inline]
fn try_ensure_unique<D>(_: &mut ArrayBase<Self, D>)
Expand All @@ -475,7 +475,7 @@ unsafe impl<'a, A> RawDataMut for ViewRepr<&'a mut A>
}
}

unsafe impl<'a, A> Data for ViewRepr<&'a mut A>
unsafe impl<A> Data for ViewRepr<&mut A>
{
fn into_owned<D>(self_: ArrayBase<Self, D>) -> Array<Self::Elem, D>
where
Expand All @@ -492,7 +492,7 @@ unsafe impl<'a, A> Data for ViewRepr<&'a mut A>
}
}

unsafe impl<'a, A> DataMut for ViewRepr<&'a mut A> {}
unsafe impl<A> DataMut for ViewRepr<&mut A> {}

/// Array representation trait.
///
Expand Down Expand Up @@ -533,7 +533,7 @@ pub unsafe trait DataOwned: Data
pub unsafe trait DataShared: Clone + Data + RawDataClone {}

unsafe impl<A> DataShared for OwnedArcRepr<A> {}
unsafe impl<'a, A> DataShared for ViewRepr<&'a A> {}
unsafe impl<A> DataShared for ViewRepr<&A> {}

unsafe impl<A> DataOwned for OwnedRepr<A>
{
Expand Down Expand Up @@ -571,7 +571,7 @@ unsafe impl<A> DataOwned for OwnedArcRepr<A>
}
}

unsafe impl<'a, A> RawData for CowRepr<'a, A>
unsafe impl<A> RawData for CowRepr<'_, A>
{
type Elem = A;

Expand All @@ -587,7 +587,7 @@ unsafe impl<'a, A> RawData for CowRepr<'a, A>
private_impl! {}
}

unsafe impl<'a, A> RawDataMut for CowRepr<'a, A>
unsafe impl<A> RawDataMut for CowRepr<'_, A>
where A: Clone
{
#[inline]
Expand Down Expand Up @@ -615,7 +615,7 @@ where A: Clone
}
}

unsafe impl<'a, A> RawDataClone for CowRepr<'a, A>
unsafe impl<A> RawDataClone for CowRepr<'_, A>
where A: Clone
{
unsafe fn clone_with_ptr(&self, ptr: NonNull<Self::Elem>) -> (Self, NonNull<Self::Elem>)
Expand Down Expand Up @@ -681,7 +681,7 @@ unsafe impl<'a, A> Data for CowRepr<'a, A>
}
}

unsafe impl<'a, A> DataMut for CowRepr<'a, A> where A: Clone {}
unsafe impl<A> DataMut for CowRepr<'_, A> where A: Clone {}

unsafe impl<'a, A> DataOwned for CowRepr<'a, A>
{
Expand Down
4 changes: 2 additions & 2 deletions src/dimension/axes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub struct AxisDescription
copy_and_clone!(AxisDescription);
copy_and_clone!(['a, D] Axes<'a, D>);

impl<'a, D> Iterator for Axes<'a, D>
impl<D> Iterator for Axes<'_, D>
where D: Dimension
{
/// Description of the axis, its length and its stride.
Expand Down Expand Up @@ -99,7 +99,7 @@ where D: Dimension
}
}

impl<'a, D> DoubleEndedIterator for Axes<'a, D>
impl<D> DoubleEndedIterator for Axes<'_, D>
where D: Dimension
{
fn next_back(&mut self) -> Option<Self::Item>
Expand Down
6 changes: 3 additions & 3 deletions src/dimension/ndindex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ unsafe impl<const N: usize> NdIndex<IxDyn> for [Ix; N]
}
}

impl<'a> IntoDimension for &'a [Ix]
impl IntoDimension for &[Ix]
{
type Dim = IxDyn;
fn into_dimension(self) -> Self::Dim
Expand All @@ -264,7 +264,7 @@ impl<'a> IntoDimension for &'a [Ix]
}
}

unsafe impl<'a> NdIndex<IxDyn> for &'a IxDyn
unsafe impl NdIndex<IxDyn> for &IxDyn
{
fn index_checked(&self, dim: &IxDyn, strides: &IxDyn) -> Option<isize>
{
Expand All @@ -276,7 +276,7 @@ unsafe impl<'a> NdIndex<IxDyn> for &'a IxDyn
}
}

unsafe impl<'a> NdIndex<IxDyn> for &'a [Ix]
unsafe impl NdIndex<IxDyn> for &[Ix]
{
fn index_checked(&self, dim: &IxDyn, strides: &IxDyn) -> Option<isize>
{
Expand Down
2 changes: 1 addition & 1 deletion src/impl_cow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::imp_prelude::*;
/// Methods specific to `CowArray`.
///
/// ***See also all methods for [`ArrayBase`]***
impl<'a, A, D> CowArray<'a, A, D>
impl<A, D> CowArray<'_, A, D>
where D: Dimension
{
/// Returns `true` iff the array is the view (borrowed) variant.
Expand Down
4 changes: 2 additions & 2 deletions src/impl_views/constructors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ where D: Dimension
}

/// Private array view methods
impl<'a, A, D> ArrayView<'a, A, D>
impl<A, D> ArrayView<'_, A, D>
where D: Dimension
{
/// Create a new `ArrayView`
Expand All @@ -254,7 +254,7 @@ where D: Dimension
}
}

impl<'a, A, D> ArrayViewMut<'a, A, D>
impl<A, D> ArrayViewMut<'_, A, D>
where D: Dimension
{
/// Create a new `ArrayView`
Expand Down
2 changes: 1 addition & 1 deletion src/impl_views/indexing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ pub trait IndexLonger<I>
unsafe fn uget(self, index: I) -> Self::Output;
}

impl<'a, 'b, I, A, D> IndexLonger<I> for &'b ArrayView<'a, A, D>
impl<'a, I, A, D> IndexLonger<I> for &ArrayView<'a, A, D>
where
I: NdIndex<D>,
D: Dimension,
Expand Down
2 changes: 1 addition & 1 deletion src/impl_views/splitting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::slice::MultiSliceArg;
use num_complex::Complex;

/// Methods for read-only array views.
impl<'a, A, D> ArrayView<'a, A, D>
impl<A, D> ArrayView<'_, A, D>
where D: Dimension
{
/// Split the array view along `axis` and return one view strictly before the
Expand Down
Loading

0 comments on commit 5b449e8

Please sign in to comment.