Skip to content

Commit dbaebd0

Browse files
authored
Move from .iter().any() to .contains and fixes some typos (#1509)
1 parent 8bd70b0 commit dbaebd0

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
@@ -2338,7 +2338,7 @@ impl<A, D: Dimension> ArrayRef<A, D>
23382338
/// The implementation creates a view with strides set to zero for the
23392339
/// axes that are to be repeated.
23402340
///
2341-
/// The broadcasting documentation for Numpy has more information.
2341+
/// The broadcasting documentation for NumPy has more information.
23422342
///
23432343
/// ```
23442344
/// use ndarray::{aview1, aview2};
@@ -2690,7 +2690,7 @@ where
26902690

26912691
impl<A, D: Dimension> ArrayRef<A, D>
26922692
{
2693-
/// Perform an elementwise assigment to `self` from `rhs`.
2693+
/// Perform an elementwise assignment to `self` from `rhs`.
26942694
///
26952695
/// If their shapes disagree, `rhs` is broadcast to the shape of `self`.
26962696
///
@@ -2702,7 +2702,7 @@ impl<A, D: Dimension> ArrayRef<A, D>
27022702
self.zip_mut_with(rhs, |x, y| x.clone_from(y));
27032703
}
27042704

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

2721-
/// Perform an elementwise assigment to `self` from element `x`.
2721+
/// Perform an elementwise assignment to `self` from element `x`.
27222722
pub fn fill(&mut self, x: A)
27232723
where A: Clone
27242724
{
@@ -3212,7 +3212,7 @@ impl<A, D: Dimension> ArrayRef<A, D>
32123212
let mut result = self.to_owned();
32133213

32143214
// Return early if the array has zero-length dimensions
3215-
if self.shape().iter().any(|s| *s == 0) {
3215+
if result.shape().contains(&0) {
32163216
return result;
32173217
}
32183218

0 commit comments

Comments
 (0)