Skip to content

Commit dedb15f

Browse files
authored
Merge pull request #1190 from jturner314/cherry-pick-1171
Cherry pick non-breaking portions of #1171 to 0.15.x
2 parents 739316e + 1d0212c commit dedb15f

File tree

10 files changed

+25
-24
lines changed

10 files changed

+25
-24
lines changed

src/arrayformat.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ where
189189
/// to each element.
190190
///
191191
/// The array is shown in multiline style.
192-
impl<'a, A: fmt::Display, S, D: Dimension> fmt::Display for ArrayBase<S, D>
192+
impl<A: fmt::Display, S, D: Dimension> fmt::Display for ArrayBase<S, D>
193193
where
194194
S: Data<Elem = A>,
195195
{
@@ -203,7 +203,7 @@ where
203203
/// to each element.
204204
///
205205
/// The array is shown in multiline style.
206-
impl<'a, A: fmt::Debug, S, D: Dimension> fmt::Debug for ArrayBase<S, D>
206+
impl<A: fmt::Debug, S, D: Dimension> fmt::Debug for ArrayBase<S, D>
207207
where
208208
S: Data<Elem = A>,
209209
{
@@ -217,7 +217,7 @@ where
217217
", shape={:?}, strides={:?}, layout={:?}",
218218
self.shape(),
219219
self.strides(),
220-
layout = self.view().layout()
220+
self.view().layout(),
221221
)?;
222222
match D::NDIM {
223223
Some(ndim) => write!(f, ", const ndim={}", ndim)?,
@@ -231,7 +231,7 @@ where
231231
/// to each element.
232232
///
233233
/// The array is shown in multiline style.
234-
impl<'a, A: fmt::LowerExp, S, D: Dimension> fmt::LowerExp for ArrayBase<S, D>
234+
impl<A: fmt::LowerExp, S, D: Dimension> fmt::LowerExp for ArrayBase<S, D>
235235
where
236236
S: Data<Elem = A>,
237237
{
@@ -245,7 +245,7 @@ where
245245
/// to each element.
246246
///
247247
/// The array is shown in multiline style.
248-
impl<'a, A: fmt::UpperExp, S, D: Dimension> fmt::UpperExp for ArrayBase<S, D>
248+
impl<A: fmt::UpperExp, S, D: Dimension> fmt::UpperExp for ArrayBase<S, D>
249249
where
250250
S: Data<Elem = A>,
251251
{
@@ -258,7 +258,7 @@ where
258258
/// to each element.
259259
///
260260
/// The array is shown in multiline style.
261-
impl<'a, A: fmt::LowerHex, S, D: Dimension> fmt::LowerHex for ArrayBase<S, D>
261+
impl<A: fmt::LowerHex, S, D: Dimension> fmt::LowerHex for ArrayBase<S, D>
262262
where
263263
S: Data<Elem = A>,
264264
{
@@ -272,7 +272,7 @@ where
272272
/// to each element.
273273
///
274274
/// The array is shown in multiline style.
275-
impl<'a, A: fmt::Binary, S, D: Dimension> fmt::Binary for ArrayBase<S, D>
275+
impl<A: fmt::Binary, S, D: Dimension> fmt::Binary for ArrayBase<S, D>
276276
where
277277
S: Data<Elem = A>,
278278
{

src/arraytraits.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ where
252252
}
253253
}
254254

255-
impl<'a, S, D> hash::Hash for ArrayBase<S, D>
255+
impl<S, D> hash::Hash for ArrayBase<S, D>
256256
where
257257
D: Dimension,
258258
S: Data,

src/data_traits.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ pub unsafe trait DataMut: Data + RawDataMut {
162162
/// Returns whether the array has unique access to its data.
163163
#[doc(hidden)]
164164
#[inline]
165+
#[allow(clippy::wrong_self_convention)] // mut needed for Arc types
165166
fn is_unique(&mut self) -> bool {
166167
self.try_is_unique().unwrap()
167168
}

src/dimension/dynindeximpl.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ impl<T> Deref for IxDynRepr<T> {
2121
debug_assert!(len as usize <= ar.len());
2222
unsafe { ar.get_unchecked(..len as usize) }
2323
}
24-
IxDynRepr::Alloc(ref ar) => &*ar,
24+
IxDynRepr::Alloc(ref ar) => ar,
2525
}
2626
}
2727
}
@@ -33,7 +33,7 @@ impl<T> DerefMut for IxDynRepr<T> {
3333
debug_assert!(len as usize <= ar.len());
3434
unsafe { ar.get_unchecked_mut(..len as usize) }
3535
}
36-
IxDynRepr::Alloc(ref mut ar) => &mut *ar,
36+
IxDynRepr::Alloc(ref mut ar) => ar,
3737
}
3838
}
3939
}

src/dimension/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ where
333333
}
334334
}
335335

336-
impl<'a> DimensionExt for [Ix] {
336+
impl DimensionExt for [Ix] {
337337
#[inline]
338338
fn axis(&self, axis: Axis) -> Ix {
339339
self[axis.index()]

src/dimension/ndindex.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ unsafe impl<'a> NdIndex<IxDyn> for &'a IxDyn {
216216

217217
unsafe impl<'a> NdIndex<IxDyn> for &'a [Ix] {
218218
fn index_checked(&self, dim: &IxDyn, strides: &IxDyn) -> Option<isize> {
219-
stride_offset_checked(dim.ix(), strides.ix(), *self)
219+
stride_offset_checked(dim.ix(), strides.ix(), self)
220220
}
221221
fn index_unchecked(&self, strides: &IxDyn) -> isize {
222222
zip(strides.ix(), *self)

src/impl_constructors.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,7 @@ where
634634

635635
#[deprecated(note = "This method is hard to use correctly. Use `uninit` instead.",
636636
since = "0.15.0")]
637+
#[allow(clippy::uninit_vec)] // this is explicitly intended to create uninitialized memory
637638
/// Create an array with uninitialized elements, shape `shape`.
638639
///
639640
/// Prefer to use [`uninit()`](ArrayBase::uninit) if possible, because it is

src/iterators/lanes.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,16 @@ impl<'a, A, D: Dimension> Lanes<'a, A, D> {
3939
let ndim = v.ndim();
4040
let len;
4141
let stride;
42-
let iter_v;
43-
if ndim == 0 {
42+
let iter_v = if ndim == 0 {
4443
len = 1;
4544
stride = 1;
46-
iter_v = v.try_remove_axis(Axis(0))
45+
v.try_remove_axis(Axis(0))
4746
} else {
4847
let i = axis.index();
4948
len = v.dim[i];
5049
stride = v.strides[i] as isize;
51-
iter_v = v.try_remove_axis(axis)
52-
}
50+
v.try_remove_axis(axis)
51+
};
5352
Lanes {
5453
inner_len: len,
5554
inner_stride: stride,
@@ -108,17 +107,16 @@ impl<'a, A, D: Dimension> LanesMut<'a, A, D> {
108107
let ndim = v.ndim();
109108
let len;
110109
let stride;
111-
let iter_v;
112-
if ndim == 0 {
110+
let iter_v = if ndim == 0 {
113111
len = 1;
114112
stride = 1;
115-
iter_v = v.try_remove_axis(Axis(0))
113+
v.try_remove_axis(Axis(0))
116114
} else {
117115
let i = axis.index();
118116
len = v.dim[i];
119117
stride = v.strides[i] as isize;
120-
iter_v = v.try_remove_axis(axis)
121-
}
118+
v.try_remove_axis(axis)
119+
};
122120
LanesMut {
123121
inner_len: len,
124122
inner_stride: stride,

src/iterators/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ impl<A, D: Dimension> Iterator for Baseiter<A, D> {
103103
}
104104
}
105105

106-
impl<'a, A, D: Dimension> ExactSizeIterator for Baseiter<A, D> {
106+
impl<A, D: Dimension> ExactSizeIterator for Baseiter<A, D> {
107107
fn len(&self) -> usize {
108108
match self.index {
109109
None => 0,

src/itertools.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ where
8686
/// **Note:** To enable the macros in this crate, use the `#[macro_use]`
8787
/// attribute when importing the crate:
8888
///
89-
/// ```
89+
/// ```no_run
90+
/// # #[allow(unused_imports)]
9091
/// #[macro_use] extern crate itertools;
9192
/// # fn main() { }
9293
/// ```

0 commit comments

Comments
 (0)