Skip to content

Commit 24aa372

Browse files
committed
Move from .iter().any() to .contains and fixes some typos
1 parent da115c9 commit 24aa372

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/dimension/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ fn can_index_slice_impl<D: Dimension>(
269269
) -> Result<(), ShapeError>
270270
{
271271
// Check condition 3.
272-
let is_empty = dim.slice().iter().any(|&d| d == 0);
272+
let is_empty = dim.slice().contains(&0);
273273
if is_empty && max_offset > data_len {
274274
return Err(from_kind(ErrorKind::OutOfBounds));
275275
}

src/impl_methods.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2350,7 +2350,7 @@ impl<A, D: Dimension> ArrayRef<A, D>
23502350
/// The implementation creates a view with strides set to zero for the
23512351
/// axes that are to be repeated.
23522352
///
2353-
/// The broadcasting documentation for Numpy has more information.
2353+
/// The broadcasting documentation for NumPy has more information.
23542354
///
23552355
/// ```
23562356
/// use ndarray::{aview1, aview2};
@@ -2702,7 +2702,7 @@ where
27022702

27032703
impl<A, D: Dimension> ArrayRef<A, D>
27042704
{
2705-
/// Perform an elementwise assigment to `self` from `rhs`.
2705+
/// Perform an elementwise assignment to `self` from `rhs`.
27062706
///
27072707
/// If their shapes disagree, `rhs` is broadcast to the shape of `self`.
27082708
///
@@ -2714,7 +2714,7 @@ impl<A, D: Dimension> ArrayRef<A, D>
27142714
self.zip_mut_with(rhs, |x, y| x.clone_from(y));
27152715
}
27162716

2717-
/// Perform an elementwise assigment of values cloned from `self` into array or producer `to`.
2717+
/// Perform an elementwise assignment of values cloned from `self` into array or producer `to`.
27182718
///
27192719
/// The destination `to` can be another array or a producer of assignable elements.
27202720
/// [`AssignElem`] determines how elements are assigned.
@@ -2730,7 +2730,7 @@ impl<A, D: Dimension> ArrayRef<A, D>
27302730
Zip::from(self).map_assign_into(to, A::clone);
27312731
}
27322732

2733-
/// Perform an elementwise assigment to `self` from element `x`.
2733+
/// Perform an elementwise assignment to `self` from element `x`.
27342734
pub fn fill(&mut self, x: A)
27352735
where A: Clone
27362736
{
@@ -3230,7 +3230,7 @@ impl<A, D: Dimension> ArrayRef<A, D>
32303230
let mut result = self.to_owned();
32313231

32323232
// Must guarantee that the array isn't empty before checking for contiguity
3233-
if result.shape().iter().any(|s| *s == 0) {
3233+
if result.shape().contains(&0) {
32343234
return result;
32353235
}
32363236

0 commit comments

Comments
 (0)